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

nRF52 UART connection with constant data stream capability

Hello, I am working on a project where I have 2 nRF52832 boards with the PCA10040. I have the example developer code examples. I am using the central and peripheral code examples to talk from one UART to another on Tera Term. Although, I noticed that this code is structured so that data is piled in an array and only sent to the other UART when I press "enter" or if it reaches a maximum size (which is very large). I am only using Tera Term to test my boards and not as part of the project. I have an external source of data that works properly on its own and am trying to use these UARTs to establish wireless communication. I have cut the solder bridges SB 22-25 to isolate PO.05 - PO.08 from nRF52832 to the Interface MCU. In pins 6 and 8 on both boards, I put TXD and RXD. Essentially what I am trying to do is have data go though the TXD & RXD wires to one UART, then wirelessly transfer data to the other UART, and have TXD & RXD wires come back. This processes will not work unless the code is structured so that data can be processed (sent & received) continuously. Or at least have it to where whatever is stacked up in the buffer is sent out every interval. I have attached the part of the code for both Central and Peripheral examples that specifically deal with data in UART. I have also put a diagram of sorts to help visualize. Any help would be great. Thanks.

Parents Reply Children
  • Hey, so i was thinking of a possible way to alter the timer. I wanted to make the timer so that it is dependent on the input rather than being a continuous timer loop. As of right now, I have the interval at about 50 ticks ( 50 ms ), and it seems fine but i feel changing this would fix some of the problems I am having. If i wanted to make it to where, everytime a character/bit of data is added to the array, the timer is reset. so as long as data keeps coming in, the timer keeps resetting. When the last bit of data were to come in, there would not be another for it to reset the timer. This is where the timer could turn on and send the data array at the end of the interval and stay on until the next bit is received and resets the timer. Is this possible at all. It seems simple in terms of logic but im sure it could be troublesome in the syntax.

  • Hi, you can try to call app_timer_stop() followed by app_timer_start() in the APP_UART_DATA_READY event. This should restart the timer every time you receive a byte on the UART interface. 

  • ok thanks so much. One more question. So using the app timer examples for both central and peripheral on teraterm, I used the send file option where I prerecorded characters on a .txt file. well both boards send the file as long as it is only 19 characters or less. if it goes above 19 characters, the uart restarts. how can i increase this size to something bigger?

  • additional update. so the 19 character limit was before i incorporated the stop and start in APP_UART_DATA_READY. After using this, the functionality i am looking for works great. but in the send file option this character limit was brought down to about 4 characters. any more and it restarts the uart. So basically without the start & stop in the uart_event_handle the limit is 19 bits and with the start & stop, the limit is roughly 4 (i didn't test exactly. I tested 4 and it works and tested 8 and doesn't work so somewhere in between). so what would be causing this? and how can we make this limit bigger so that I can send files that can be at least a few dozen characters?

  • Debug logging should be enabled in the example projects, so you can use that to determine why it resets. I guess you will probably need to use easyDMA or flow control to receive larger chunks of data reliably. 

Related