Thank you very much for your reply and it certainly helps!
We are of course designing our own board which is why the dimensions are important.
I am still getting around Bluetooth 5.0 and Java (I am more used to C). I found out that BLE 5.0 is capable of sending a max. of 244 bytes in a packet. I had been pondering on a pseudocode for a fast transmission of a 500 Hz biosignal. Suppose we receive the data from an ADC in INT or UNSIGNED INT format. In that case, I want to send 200 bytes (containing 100 sample values). These 100 values are sampled at 1 ms. These 100 samples (which would take roughly 0.1 s to record) would be placed in a TX buffer and would be sent to the Master device. I would be grateful if you could check my (rough and simple) pseudocodes below to see if my concepts are right.
TX (Peripheral Side)
START:
Global Variable Buffer;
setup()
{
BLE initialization // (incl. Peripheral setting, advertising)
Establish connection with Master
}
Loop()
{
Buffer = Samples of ADC values using Waveform Class @ 1 kHz
Transmit Buffer to Master // transmitting 200 bytes (100 samples) in 0.1 sec
}
END:
RX (Master Side)
START:
Global Var flag; // flag for receiving new values in buffer
Global Var Samples_ADC; //contains 100 received ADC values
Global Var count = 0; // counter for Samples_ADC
setup()
{
Initialize Serial
Initialize Timer Interrupt
BLE initialization // (incl. Master setting, Receive advertisements)
Establish connection with Master // (Including min. and max. connection interval setting)
Flag = 0;
Timer Interrupt en = 1;
while(Flag == 0); // wait until Flag is 1
}
Timer Interrupt ISR (called after 1 ms)
{
if (count == size(Samples_ADC)) --> count = 0, Flag = 1; //reinitialize count and flag
Print(buffer(count)); // prints each value in buffer after 1 ms
count++;
}
END:
I have written down this rough C based pseudocode off the top of my head. I request you to kindly critique on it and comment if I have to worry about timing issues i.e data back log or loss etc.
Please understand my lack of knowledge of BLE. I would be grateful for any replies.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Thank you very much for your reply and it certainly helps!
We are of course designing our own board which is why the dimensions are important.
I am still getting around Bluetooth 5.0 and Java (I am more used to C). I found out that BLE 5.0 is capable of sending a max. of 244 bytes in a packet. I had been pondering on a pseudocode for a fast transmission of a 500 Hz biosignal. Suppose we receive the data from an ADC in INT or UNSIGNED INT format. In that case, I want to send 200 bytes (containing 100 sample values). These 100 values are sampled at 1 ms. These 100 samples (which would take roughly 0.1 s to record) would be placed in a TX buffer and would be sent to the Master device. I would be grateful if you could check my (rough and simple) pseudocodes below to see if my concepts are right.
TX (Peripheral Side)
START:
Global Variable Buffer;
setup()
{
BLE initialization // (incl. Peripheral setting, advertising)
Establish connection with Master
}
Loop()
{
Buffer = Samples of ADC values using Waveform Class @ 1 kHz
Transmit Buffer to Master // transmitting 200 bytes (100 samples) in 0.1 sec
}
END:
RX (Master Side)
START:
Global Var flag; // flag for receiving new values in buffer
Global Var Samples_ADC; //contains 100 received ADC values
Global Var count = 0; // counter for Samples_ADC
setup()
{
Initialize Serial
Initialize Timer Interrupt
BLE initialization // (incl. Master setting, Receive advertisements)
Establish connection with Master // (Including min. and max. connection interval setting)
}
Loop1()
{
Buffer = Receive Values
Samples_ADC = Parsed Buffer values // Contains transmitted values and parse
Flag = 0;
Timer Interrupt en = 1;
while(Flag == 0); // wait until Flag is 1
}
Timer Interrupt ISR (called after 1 ms)
{
if (count == size(Samples_ADC)) --> count = 0, Flag = 1; //reinitialize count and flag
Print(buffer(count)); // prints each value in buffer after 1 ms
count++;
}
END:
I have written down this rough C based pseudocode off the top of my head. I request you to kindly critique on it and comment if I have to worry about timing issues i.e data back log or loss etc.
Please understand my lack of knowledge of BLE. I would be grateful for any replies.
Thank you
ZJ