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

UART API Explanation & FiFo

So I can see the "API Reference" documentation on the UART driver in the info centre, however this is all very low level and I am going to waste hours going through all this trying to decode it. Also the examples appear only to use a small subset of the available functionality.

So my question is where is the higher level explanation of the UART API functionality. For example is in the ble_app_uart example it seems a bit of a waste to allocate 256 byte read and write buffers and then to call uart_event_handle every time a byte arrives.

I frequently ask myself how much time, of Nordic employees (having to answer questions) and Nordic customer, is wasted by not providing some higher level functional descriptions of the API's?

Rant Over!

Parents
  • It would be very much appreciated if you could post some examples of what your ideal UART API would look like. I will pass this information on to the developers.

  • Hi Ketil I hope the new website permits me enough characters to say everything! I don’t believe a new UART API is required, just the existing one be made more understandable (faster) through some additional documentation.

    My objective is to create a parser which reads a UART stream from a sensor. The parser determines the validity level and if the threshold is reached the stream is parsed, the required data extracted and transmitted via BLE. I will be using a proprietary profile.

     I know that my data stream starts with character Y and when good is of a certain length X and is terminated by <CR><LF>. Therefore I would simply like the UART (supporting code/Library) to accumulate into a buffer, once Y has arrived and to send me an event when I have X bytes at which point I can check for <CR><LF>

     Alternatively I would like to be the UART (Library) to accumulate into a buffer and send me an event when <LF> has arrived at which point I can check the correct amount of data that has arrived.

     The application only needs to act when the required data has arrived. Looking at the example code the programming module appears to require that the application look at every character that arrives. The examples "uart" and "ble_app_uart" both process a character at a time (this is the impression given), which conflicts with the requirement for a large FIFO buffers.

    Looking at the “UART module” documentation it would appear to work on a byte at a time. After further research I discovered the “UART Driver” which appears a better match for my programming module described above, in that the App can be notified when the require amount of data has been received. To my knowledge there is no example code for the “UART Driver”.

    I could have saved lots time if both these; “UART module” & “UART Driver” had been presented in a higher level document together with matching application scenarios for which they could provide a solution.

     Apple produces documentation, where a hierarchical approach is taken starting with application scenarios and then decomposing down to API’s. It's about ensuring the developer makes best use of their time enabling them to identifying which API's are going to contribute to their solution and this is efficiently achieved by providing context.

    Hope this helps - now to try out the "UART Driver"!!

  • Maybe you can try NRF_CLI module? Looks will fit your needs.

Reply Children
Related