This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

[nRF52811] UART connection

Hello,

I am working with an nRF52811 and I am trying to get it to send data via UART with a USB connection. I tried using the USB CDC ACM module, but it appears to only work for the nrf52840 model. What is the best way to achieve this and is there any documentation on the subject?

Best regards,
David

Parents
  • Hi,

    The nRF52811 does not have an USB peripheral as the nRF52840. You will therefore have to use a bridge of some sorts that can convert USB signals to UART.

    regards

    Jared 

  • Hi,

    Thank your for the reply. Is there any documentation or examples that could help with that? Also, I was now trying to adapt the uart example (examples/peripherals/uart), instead of the usb cdc acm example. Is this a viable approach?
    Btw, my motivation for this is that I want to communicate with the nRF52811 via UART instead of the proprietary RTT (which is working atm).

    Best regards,
    David

  • Hi,

    slid_daaviet said:
    Btw, my motivation for this is that I want to communicate with the nRF52811 via UART instead of the proprietary RTT (which is working atm).

    Are you referring to a one way communication such as logging? In that case you can just switch the logger backend to UART instead of RTT.

    regards

    Jared 

  • For now, one way communication from the nRF would sufficient. Is the switch from RTT to UART made through a define or a function call? I can't find that here:
    infocenter.nordicsemi.com/index.jsp

    I defined NRF_LOG_BACKEND_UART_ENABLED to 1 and NRF_LOG_BACKEND_RTT_ENABLED to 0. That should do it, right? However I send a log, but it doesn't appear when reading the serial port. Now, it's probably a different issue, maybe incorrect log initialization...
    When I send the logs via RTT it works, but via UART, it dosen't seem to be sending...

Reply
  • For now, one way communication from the nRF would sufficient. Is the switch from RTT to UART made through a define or a function call? I can't find that here:
    infocenter.nordicsemi.com/index.jsp

    I defined NRF_LOG_BACKEND_UART_ENABLED to 1 and NRF_LOG_BACKEND_RTT_ENABLED to 0. That should do it, right? However I send a log, but it doesn't appear when reading the serial port. Now, it's probably a different issue, maybe incorrect log initialization...
    When I send the logs via RTT it works, but via UART, it dosen't seem to be sending...

Children
  • Hi,

    Yes mostly, this should be included:

    // <e> NRF_LOG_BACKEND_UART_ENABLED - nrf_log_backend_uart - Log UART backend
    //==========================================================
    #ifndef NRF_LOG_BACKEND_UART_ENABLED
    #define NRF_LOG_BACKEND_UART_ENABLED 1
    #endif
    // <o> NRF_LOG_BACKEND_UART_TX_PIN - UART TX pin 
    #ifndef NRF_LOG_BACKEND_UART_TX_PIN
    #define NRF_LOG_BACKEND_UART_TX_PIN 6
    #endif
    
    // <o> NRF_LOG_BACKEND_UART_BAUDRATE  - Default Baudrate
     
    // <323584=> 1200 baud 
    // <643072=> 2400 baud 
    // <1290240=> 4800 baud 
    // <2576384=> 9600 baud 
    // <3862528=> 14400 baud 
    // <5152768=> 19200 baud 
    // <7716864=> 28800 baud 
    // <10289152=> 38400 baud 
    // <15400960=> 57600 baud 
    // <20615168=> 76800 baud 
    // <30801920=> 115200 baud 
    // <61865984=> 230400 baud 
    // <67108864=> 250000 baud 
    // <121634816=> 460800 baud 
    // <251658240=> 921600 baud 
    // <268435456=> 1000000 baud 
    
    #ifndef NRF_LOG_BACKEND_UART_BAUDRATE
    #define NRF_LOG_BACKEND_UART_BAUDRATE 30801920
    #endif
    
    // <o> NRF_LOG_BACKEND_UART_TEMP_BUFFER_SIZE - Size of buffer for partially processed strings. 
    // <i> Size of the buffer is a trade-off between RAM usage and processing.
    // <i> if buffer is smaller then strings will often be fragmented.
    // <i> It is recommended to use size which will fit typical log and only the
    // <i> longer one will be fragmented.
    
    #ifndef NRF_LOG_BACKEND_UART_TEMP_BUFFER_SIZE
    #define NRF_LOG_BACKEND_UART_TEMP_BUFFER_SIZE 64
    #endif
    
    // </e>

    Are you measuring on the correct pin?

    regards

    Jared 

  • I have the same configuration.
    Actually, the nRF52811 is connected to an nRF52840 that is used as a bridge (for flashing the code and reading data), which is turn is connected to the PC via a usb cable. When I plug the usb cable, a serial port is opened and I am reading that port.

  • So the nRF52811 will be transmitting the logs on Pin 6. Is this pin connected to the nRF52840 and is that relayed onwards to your PC?

    It would be best if you could measure directly on the TX pin and verify if you can see data being sent or not.

Related