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] two way UART connection

Hello,

I am currently using the logger backend to send information via UART from the nRF52811 to a PC. This works well, but only for one way communication. I would like to send some instructions from the PC to the nRF52811, which means having a two way communication via UART. Is this even possible?

Thanks in advance.
David

Parents Reply Children
  • Hi,

    The CLI interface can be used for anything, not just control logging (see for instance the crypto CLI example). It is a bit complex though, so an alternative could be to skip the logger module altogether (including CLI) and use a simpler UART library for your UART communication. See for instance how physical UART is used in the NUS example.

  • Hi,

    Thanks for the tip, but that example is for UART over BLE, which is not exactly what I'm looking for. 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 in the usb cable, a serial port is opened and I am reading that port. So, I am already receiving data from the nRF52811, but I would like to just send data through that serial port from the PC to the nRF52811.

  • Hi,

    slid_daaviet said:
    Thanks for the tip, but that example is for UART over BLE, which is not exactly what I'm looking for.

    Yes, but the thing is that the example implements UART bridging over BLE (so both physical UART and NUS). If you ignore the BLE/NUS part, you are left with a simple example of using plain UART without the added complexity of the logger library. You can also refer to the UART example for something similar.

    slid_daaviet said:
    So, I am already receiving data from the nRF52811, but I would like to just send data through that serial port from the PC to the nRF52811.

    I see. The easiest way is to refer to one of the examples mentioned above, which implements bidirectional UART communication.

  • Thanks for the help. I have tried adapting this example to the nRF52811, without success so far. I think the problem is in the APP_UART_FIFO_INIT function, but can't even debug it correctly, because there is a call to the app_error_handler funcion and NRF_BREAKPOINT_COND is activated. It's probably a vague problem description, but that's what I know so far...

  • Hi,

    slid_daaviet said:
    I have tried adapting this example to the nRF52811, without success so far.

    There was a problem with the link to the example you are using. Can you post it again?

    slid_daaviet said:
    I think the problem is in the APP_UART_FIFO_INIT function

    I see. What did you do to debug? The APP_UART_FIFO_INIT() essentially created two static buffers, and then calls app_uart_init(). If there is an issue, that should return an error code.

    slid_daaviet said:
    because there is a call to the app_error_handler funcion and NRF_BREAKPOINT_COND is activated.

    This is to aid debugging. It breaks on error, and then you can inspect with a debugger. What error code was returned from where? As you point to APP_UART_FIFO_INIT I assume you see it is from app_uart_init()? You may be interested in An introduction to error handling in nRF5 projects.

Related