Author
Topic: Faulty Transmissions (Read 1558 times)

I have a project, where I send data to an Android phone. I get data via the serial port to the rfduino and then send this data to the phone. First I had 20Byte Data Chunks. I use "Serial Event" to set a Flag and then read and send the data within the main loop.

Now I have 40 Bytes of data. The Rfduino reads 40Bytes of serial data and sends it in two parts (see code). The first byte of each part is an identifier used to distunguish between the different packets. After some successful transmissions the data becomes corrupt.

I checked the serial data with a logic analyzer and there is nothing wrong with it.

I also used wireshark to check the ble transmissions. Both 20 Byte chuncks are send within the same connection interval.The data sent by the RFduino becomes corrupt after some time.

The serial baud rate is 9600.

When I omit the second .send command and just send 20 Bytes, the problem does not occur.

I assume, that the radio interferes with the reading of the serial port. I tried to use "while(RFduinoBLE.radioActive);" before the Serial.read, but I think the data is buffered before that. So this did not change anything.

I would apreciate any thoughts on this problem!Does anyone have an idea what is going on?

I don't think you are using the serialEvent correctly. It doesn't work the same as in a typical Arduino AVR library.In the RFduino / Simblee libraries it is a real interrupt handler. So you use it something like this snippet. You'll have to psych out how to do what you need it to do, like putting characters into your own buffer queues and dealing with those.

//==============================================================// Test Serial Port for RAW Mode request// CRITICAL: on RFduino/Simblee serialEvent is a true interrupt.// DO NOT do any print statements in here. Get out quick.void serialEvent(void){ int ch;