Help me connect a PIC24FJ128GA310 mounted on an Explorer 16 board

Discussion in 'Surface - Peripherals' started by lingyueqing, Apr 6, 2018.

  1. lingyueqing

    lingyueqing New Member

    Joined:
    Apr 6, 2018
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    My Device:
    None
    I'm trying to connect a PIC24FJ128GA310(PIC24FJ128GA310-I/BG - Microchip Technology - Embedded - Microcontrollers - Kynix Semiconductor) mounted on an Explorer 16 board with an embedded wireless module. I have been able to set up both to communicate perfectly well with PuTTY (an equivalent to Hyperterminal), but they won't communicate with each other!
    [​IMG]
    I haven't configured UART for a microcontroller before, but here is my set-up code (which works for PuTTY):

    RPOR8bits.RP17R = 5; // RP5 as U2TX mapped for peripheral pin select
    RPINR19bits.U2RXR = 10; // RP10 as U2RX mapped for selectable input source
    U2BRG = 25; // 9600 baud rate
    U2MODEbits.UARTEN = 1; // UART2 is enabled
    U2MODEbits.ABAUD = 0; // Auto-baud disabled
    U2MODEbits.RTSMD = 0; // 0 = Flow Control and 1 = Simplex
    U2MODEbits.BRGH = 0; // Low baud rate
    U2STAbits.UTXEN = 1; // Transmit enabled
    Can anyone help? I have tried both straight-through and null modem cables. The microcontroller is able to show reception of a signal on the U2STAbits.URXDA 'Receive Buffer Data Available bit'.

    I can send and receive a string of three character maximum, if flow control and echo settings are the same at both ends, and I terminate the string with '\0'. No hardware is connecting the two except for the RS232 cable and null modem adapter. However I need to reset the microcontroller after each attempt in order for it to show a signal received again. Why do I need to reset it, and why is 3 the maximum number of characters?

    When I say it works with PuTTY, I mean that using this equivalent to Hyperterminal I am able to send messages to the microcontroller which are displayed on the Explorer 16 LCD display with no problems (if it echoes the characters received back to PuTTY).

    *RESOLVED: it was a receive buffer overflow. @Madmanguruman I tried answering but the website won't let me for 8 hours after posting the question, so will do it later...
     
  2. GreyFox7

    GreyFox7 Super Moderator Staff Member

    Joined:
    Jul 27, 2014
    Messages:
    6,897
    Likes Received:
    1,385
    Trophy Points:
    113
    Interesting... Although you didn't say what you were attempting to connect it with. I assume a Surface of some kind. I always wanted an 11 x 11 matrix display. :)

    Hit the Marked Solved link please.
     

Share This Page