I'm trying to create a program that takes a stream of UART data at 115k baud streaming in and sends it over BLE as fast as possible. So far, I've
(1)Verified/ made some tweaks to the Nordic UART Service (NUS) and validated I can see the stream with the "nRF UART v2.0" app (2)Verified the APP_Template works (3)Worked to merge the NUS into the template so I can have peer management
I'm not seeing serial data with the nRF UART app on my Android device, however I see it with DEBUG level enabled in logging.
Update 2: It looks like nus_send is failing because of NRF_ERROR_INVALID_STATE. Even if I go into my nRF UART app and it says "Connected", this error persists. Any ideas?
Going into the ble_nus_string_send() function in debug, it definitely looks like this is happening because p_nus->conn_handle is showing BLE_CONN_HANDLE_INVALID, however it's not clear why this would be set.
Since it looks like I'm getting closer, I'm going to put most of the "old" info in quotes
I've managed to work past a few quirks, and now I can
- Initialize UART/ NUS similar to the example
- Initialize the NUS UUID (took some RAM tweaks in the linker file)
- Connect to my phone as a peer... at first RTT Viewer showed last night:
0> APP:INFO:Light it up!
0> APP:INFO:Fast advertising.
0> APP:INFO:Connected to a previously bonded device.
0> APP:INFO:Local Cache applied
0> APP:INFO:Connected.
0> APP:INFO:Peer Update Succeeded
0> APP:INFO:Peer Update Succeeded
[The device would essentially just sit here with no activity. UART Classic would generate a fatal error]
0> APP:INFO:Disconnected.
However, now when I connect to the app via nRF UART v2.0, I see "Connected", but there's no activity. If I pause execution in eclipse, debugging points to a UART overrun (so far as I can tell from the attached image). I searched a few other questions, and the general thought was "there's too much going on to take a UART stream without flow control and manage BLE" - so I enabled eDMA and disabled legacy UART, in hopes that I could at least just pull what data I can out of memory, and then take a look at what UART data I may have lost and then tweak my code accordingly. ERRORSC.jpg Even with eDMA, I still seem to be running into errors when execution is paused. Interestingly, if I disconnect the other module's TX line, connect my phone via the nRF UART app, and then plug in the TX line, I instantly hit a UART overflow error (sometimes framing), and NUS doesn't even try to send.
Last night I disabled UART Legacy s
upport (traditional TX/ RX interrupts) and enabled eDMA. Here's the interesting part:
- Setting NRF log level to DEBUG, I see my UART stream! The application comes up, broadcasts, and just sits there filling up the terminal with UART data.
- When I connect with the UART app on my phone, it shows connected, but no UART data (even though it's still streaming across the screen in RTT Viewer)
- Now when I try and pair with my phone, pairing to my Android device is rejected! Unplugging the UART (so I can see what's happening in terminal) I show:
- 0> APP:INFO:Connected to a previously bonded device. 0> APP:INFO:Local Cache applied 0> APP:INFO:Connected. 0> APP:INFO:Security Rejected- already bonded 0> APP:INFO:Disconnected. 0> APP:INFO:Fast advertising. [Second attempt] 0> APP:INFO:Connected to a previously bonded device. 0> APP:INFO:Local Cache applied 0> APP:INFO:Connected. 0> APP:INFO:Security Rejected- already bonded 0> APP:INFO:Disconnected. 0> APP:INFO:Fast advertising.
When debugging using eDMA and , I only see UART errors when pausing the application (I assume the hardware is still running but can't transfer?). Not as concerned since I can see UART now, but I've copied that too. ERROR-eDMA.jpg Any ideas as to what's going on?
(Project info) SDK_13.1.0_7ca7556
S132 Soft Device
nrf52832