Asynchronous UART API (DMA) not working like expected on nrf52840

hi,
i am trying to use the async uart api on a nrf52840 for communicating to a quectel bg95 modem.
no matter which timeout or buffer-size i am using, i am experiencing the problem that that some (1-2) bytes of the modem response are not received (or forwarded via the api) when they are arriving ... they are received with delay, when the next response of the modem comes in.

so the usual communication flow to the modem is:
(1) request from nrf -> modem
(2) response from the modem -> nrf (usually ending with "\r\n")
(3) some delay
(4) next request from nrf -> modem
(5) next response from the modem -> nrf

when using the async api it happens very often, that one or both of "\r\n" of (2) are missing as long as the response of (5) is beginning to come in. then the response of (5) is prepended with the missing "\r\n" of (2).

Parents Reply Children
  • That kind of issues normally happens in some variables (normally global variables) when accessed in different contexts. 

    In you code 

    k_msgq_put( &Qud_rxQueue, &e, K_NO_WAIT );

    Check how you declared "e" and how you are accessing it. It looks like there could data access issue. I cannot be sure that the issue is just with this variable, but there is not much code to review.  In any case, i am quite confident that the issue is most likely in the code changes you did in your application. It would help to attach the whole setup (files) so that I can replicate this issue and assist you better.

Related