This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How is the RTS-pin controlled in UART with flowcontrol

I am using a nrf52832 to communicate via UART to a GSM module (AT commands).

I have setup the device with a baud rate of 9600 and using HW flowcontrol. The nrf52 is doing other stuff at the same time such as communicating via bluetooth.

The problem occurs when the AT commands gets longer. After the nrf52 has send its command it sets the RTS pin and the GSM module can't send its response. The pin isn't cleared until the nrf52 sends a new command. See the picture below (0 is TX, 1 is RX, 2 is CTS, 3 is RTS).

image description

I know the pin is supposed to be set when the softdevice does something, but in what other cases is it set, and what might cause it in this case?

edit: Accidently wrote spi instead of uart

edit: Thanks for the insight guys. It helped me solve the problem. In my case I had a breakpoint in a different part of the code that sometimes triggered. This of course stopped the processor and the rx fifo would fill up.

Parents Reply Children
  • This is a very old question. I don't have access to the code in the form it was in back then, and now it looks completely different.

    But I didn't do anything different from the example projects. My problem back then was that I was setting break points elsewhere in the code, and that blocked the uart connection from operating as I expected.

    I will add a comment with what I can salvage from back then and fit in a comment, but I can't guarantee it will work.

  • static const app_uart_comm_params_t comm_params = { GSM_RX_PIN_NUMBER, GSM_TX_PIN_NUMBER, GSM_RTS_PIN_NUMBER, GSM_CTS_PIN_NUMBER, GSM_UART_FLOW_CONTROL, GSM_USE_PARITY, GSM_UART_BAUDRATE };

    void uart_evt_callback(app_uart_evt_t * uart_evt) { if (uart_evt->evt_type == APP_UART_DATA_READY) uint8_t cr; while(app_uart_get(&cr) == NRF_SUCCESS) { //cr should now contain the data } } }

    uint32_t gsm_uart_init(void) { return APP_UART_FIFO_INIT(&comm_params, GSM_UART_RX_BUF_SIZE, GSM_UART_TX_BUF_SIZE, uart_evt_callback, GSM_UART_PRIORITY, error_code); }

Related