6 years, 10 months ago.

RN2483

This question is relevant to any project trying to bridge a platform's built in USB to UART controller with a second on board UART.

Quote:

In my case, I'm trying to type AT style commands on a computer connected by USB to a NXP FRDM microcontroller that exposes UART0 (hardwired to USB) as well as UART1 on pins PTC3(RX) and PTC4(TX) connected to a LoRa IC:

FRDM-KL25Z Platform document
RN2483 IC device datasheet

Missing text output from second connected UART

#include "mbed.h"

Serial Conn(USBTX, USBRX);
Serial Lora(PTC4, PTC3);

int main() {
    Conn.baud(57600); // 57600 baud is specified in the
    Lora.baud(57600); // Microchip RN2483 datasheet
    Conn.printf("RN2483 Communication!\r\n"); // This works
    Lora.printf("sys get ver\r\n"); // This fails? No text returned.

    // Try passing characters
    while(1) {
        if(Conn.readable()) {
            Lora.putc(Conn.getc());
        }
        if(Lora.readable()) {
            Conn.putc(Lora.getc());
        }
    }
}

Question

This seems logically correct, and providing the 'PTC[34]' parameters to a RN2483 mbed library correctly communicates with the IC's UART and prints characters in my serial console. So why isn't anything appearing in my serial console when I manually configure (and avoid the RN2483 lib) two serial connections?

Answer

This problem was solved by properly capturing line ending characters and remapping to CR+LF which is what the IC device expects to terminate all command sequences. I may post more information (like a program) later.

1 Answer

6 years, 1 month ago.

Serial.printf works a bit weird. This is how I did it.

#include "mbed.h"
Serial lora(D8,D2);
Serial pc(USBTX,USBRX);
int main()
{
    lora.baud(57600);
    pc.baud(57600);

    pc.printf("HelloWorld!\n"); 
    
    char str[64] = "sys get ver\r\n\0";
    int i=0;
    while(str[i]!='\0') {
        lora.putc(str[i]);
        i++;   
    }
    
    while(1) {
        if(lora.readable()) {
            pc.putc(lora.getc());
        }
    }
}