pic24fj128ga310 uart not working in application

My question is pic24fj128ga310 uart not working in application, but works with PuTTY.
I’m trying to connect a Microchip PIC24FJ128GA310 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!

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…

So it seems to be resolved :smiley:


Yes. I have figured it out.Thank you very much! :unamused: :unamused: