Hi everyone - thank you in advance for your support with this.
Our team's goal is to sample ADC data on a single channel at a sample rate of 500 Hz and send that to a laptop via BLE.
System:
- Transmitter: nrf52DK (nrf52832)
- Receiver: laptop (Python script)
I started with the example in: https://github.com/NordicPlayground/nRF52-ADC-examples/blob/master/ble_app_uart__saadc_timer_driven__scan_mode/main.c. I'm programming the dev board using Segger Embedded Studio.
I modified the example to sample on only one channel and at a rate of 500 Hz. I (ideally) want to also send that data a rate of 500 samples/second; in the example, sampling and sending are both happening inside the callback, so I moved the sending logic into a separate method and created a ring buffer that would populate with SAADC samples and send at various intervals.
My issue at the moment is that even though the negotiated MTU size between central and peripheral is 244 bytes (verified by printing m_ble_nus_max_data_len after negotiation and immediately before sending - I can see the value change from 20 bytes to 244 bytes when the connection is established), my receiver (which is a simple Python script that simply prints out the packet exactly as it's received) seems to only be receiving a maximum of 64 bytes per packet. I wrote a minimal example that attempts to send a simple buffer that is 244 bytes long (attempted with integers, repeating characters, binary data), but see the same issue of only receiving 64 bytes per packet.
I don't want to continue development until I can verify that at least one packet is being sent and received exactly as expected, so ideally want to see 244 bytes being sent and received in a single packet before continuing. My idea is that after I can confirm that I can send 244 bytes per packet, I can then package the 500 samples into appropriate packets and send them in single packets to my receiver. If there's a better way to implement this, I would love to hear that too.
I'm new to both Nordic and bluetooth communication in general so would really appreciate your support with this; I've been struggling with it for a while and this is actively stopping a high-priority project's development.
Thanks so much, appreciate your support.