consistance in ble data transmission

Hello Everyone,

Is it possible to achieve BLE data transmission consistency like there are central and server? The server (nrf52832) reads the GPIO state change and sends it to the client. 

Here, I achieved the functionality of reading the gpio state change and sending it to the client once the connection is established. 

here state change from 0 to 1, sending both. if the button is pressed the server sends '0' and if the button is released server sends '1'. Here '0' transmission is important. 

here for every button press '0' transmission is important. for transmitting data(0) from server to client it is taking 47ms time. i tried for 10 times. but it taking 42ms,44ms,45ms,48ms,41ms like from 41ms to 48ms it is taking to send from server to client. 

here if the first sample takes 47ms time from server to client, is it possible to maintain the same time for the remaining 10 samples? we are sending one sample at a time. for every sample it takes different time. is it possible to maintain same time.

kindly help on this to tackle this issue.

Best regards,

Srinivasa M 

Parents
  • Hello,

    Sorry for the late reply. 

    Are you using the nRF5 SDK (e.g. in Segger Embedded Studio, Keil or IAR)? Or are you using the nRF Connect SDK (NCS)?

    We do have a sample called Led Button Service (LBS). The path to it depends on whether you are using NCS or the nRF5 SDK. What it does is that it transmits the button press on one device to the LED on the connected device, and vice versa. 

    Regarding the timing. I suspect you are using the nRF5 SDK, which by default has a debounce on the GPIO's button handler of roughly 40ms. Then depending on your connection parameters, any queued message will be sent on the next connection event. So if your connection interval is 7.5ms (which is the minimum connection interval, according to the BLE specification), then it will take 0-7.5ms to send the message, depending on how much time is left for the next connection event, occuring on every connection interval. 

    By the way that you write, asking if it is possible to have the same time for 10 samples, it sounds like you are trying to bit-bang something. Is that correct? If so, what protocol are you trying to bit-bang?

    Perhaps it is better to measure the sequence that you want to send, and then send it as a byte array to the connected device instead?

    Best regards,

    Edvin

  • Hi Edvin, 

    Thanks for the response. I am using nRF SDK and Segger Embedded Studio. As per my requirement, I have to send the data instantly so that only I can run my end device. If no instant data is sending, then the end device will not work.  if the server sends 1 to the client with a time of 40ms and after 5 seconds the server sends 1 to the client with a time of 48ms.  Here we can see that there is an 8ms latency is there. 

    for better understanding, I have attached the image below. kindly review and suggest the best solution to achieve the task.

    I

    Thanks,

    Srinivasa M

  • My end application works only when there is a 0 to 1ms deviation. If BLE is not supported, how can I achieve this with radio notifications and ESB?

    kindly suggest the best solution.

  • Hi Edvin,

    Thanks for the suggestion. I have used ESB and radio transmission. With ESB, I achieved 3ms, and with radio transmission and reception, I achieved 400us. 

    Is it possible to achieve less than 15us? that will give more accurate results.

    I observed that there is inconsistency in data transmission and reception. If 10 samples are there, every sample will be made at different times, like 246us, 330us,270us, and 400us. Is it possible to maintain a constant time of 400us for all samples?

  • That is a tough ask. It depends on what the chip is doing when the interrupt occurs. We don't have anything that supports this directly, so if you are not able to acheive it using using the raw radio, then it is difficult. If your application is doing anything else, you can try to disable that, but I don't think there is a chance that you can get it consistently within 15us. 

    What exactly are you trying to transmit? Are you bit-banging some protocol? 

    BR,

    Edvin

  • My task is to control the LED at the receiver by pressing a button on the transmitter. When I press the button, the transmitter sends 0x05 data to the receiver, and when I release the button, the transmitter sends 0x04 data to the receiver. if 0x05 is received at the receiver end the LED turns ON and if 0x04 is received at the receiver end LED turns OFF. Here the LED turn-on time is important. when I press the button the data 0x05 is transmitted and received at the receiver time is important. The total time this process is taking is 400us. some times it is taking 230us, 330us, 320us, 380us within 400us. why this time is changing every instant of the button press? 

    is it possible to make it consistent like maintaining the same time at all the instants?

    If I achieve this consistency I can use this concept in my end application. In the end application instead of LED and Button some switching modules can use. 

    At both ends nRF52832 is used.

  • I am not sure. If you upload your application, I can have a look. What you can try is to replace the bsp with what you find in the examples\peripheral\radio and instead of this, use the direct gpio interrupt that you find in examples\peripheral\pin_change_int example. This will bypass the whole button handler module, and use the pin interrupts directly. Then create the payload for your packet in the interrupt handler. Note that this doesn't have a debounce, so it may be that you see several interrupts when pressing the button on the DK, but if your intention is to not use a button interfaced by a human, but to send some signal, then you would want something like this, without a debounce.

    BR,

    Edvin

Reply
  • I am not sure. If you upload your application, I can have a look. What you can try is to replace the bsp with what you find in the examples\peripheral\radio and instead of this, use the direct gpio interrupt that you find in examples\peripheral\pin_change_int example. This will bypass the whole button handler module, and use the pin interrupts directly. Then create the payload for your packet in the interrupt handler. Note that this doesn't have a debounce, so it may be that you see several interrupts when pressing the button on the DK, but if your intention is to not use a button interfaced by a human, but to send some signal, then you would want something like this, without a debounce.

    BR,

    Edvin

Children
Related