Hi,
I am able to transfer data from my custom peripheral device with nRF52840, but data is moving much slower than it should.
I am writing 244 bytes into NUS within my peripheral and it is getting to my Android phone, but not very quickly. On the phone, I am not doing anything with the data, just counting bytes within an onCharacteristicChanged callback. I have reviewed the ble_app_uart example and I have setup my GAP parameters to match (I think). Detail is below. I am writing data as fast as possible using:
... within a loop with no sleeps. Logging shows that I am able to write out 244 bytes evey 50 mSec (20 per sec).
From what I read here: https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsds_s140%2FSDS%2Fs1xx%2Fs140.html
... I should be able to go much faster.
Setup info ...
Defines:
My codebase:
sdk_config.h:
Inits:
In main():
Implementations:
Some notes.
I am not enabling the peer manager. No pairing or bonding required.
I have not changed the phy. I understand I can go a little faster by selecting 2 Mbit/s, but I think that I should resolve timing or other issues first.
I am using a scheduler to process NUS IO on the main thread. When I receive a "command" over NUS from Android, I schedule a task using the scheduler. In this task, I read from NUS (a couple of commands) and then write 24 kBytes back (see do loop in code above). This 24kB transfer is slow.
Are there some config changes that I can make to get the speed up? It looks like I am only getting 1 packet processed in the interval (or slot?) and that this slot time is around 50 mSec. I would expect to be able to get multiple packets per slot and multiple slots every 50 mSec.
In general, this seems very slow and I should be able to speed it up quite dramatically.
Thanks in advance for suggestions. I am happy to provide more info as required.
Mark J