I am using a PIC32MX795F12 microcontroller together with a RN42 bluetooth to UART module.

I can send text to the UART with no problem at 115200 baud. Using Putty I can also enter the command $$$ to enter the command mode and get the CMD response. Unfortunately I've not been able to enter the command mode using the C code. My command to do this is as follows:


where the function is defined as:

void UART3WriteString(const char * str) {
while( *str ) {
    U3TXREG = *str++;
    while( U3STAbits.TRMT == 0 ); //wait for the transmission to be done)


When I do this, the RN42 does not go into the command mode. It just outputs $$$ without the CMD response.

Any ideas?


  • \$\begingroup\$ Maybe you need CR and/or LF too? Try UART3WriteString("$$$\r\n") \$\endgroup\$ – Roger Rowland May 22 '17 at 11:54
  • \$\begingroup\$ I've tried that before. Actually in the putty as soon as you type the third '$' the CMD response comes up. \$\endgroup\$ – Renato May 22 '17 at 11:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.