Thanks for your time stopping by.
Basically i have a serial device that im trying to interface with, my sketch runs fine standalone using arduino Serial library
But when i integrate it into multiwii, and thus use its Serial library instead i have a problem.
The problem is it reads the repeated data 'stream/sentance' successfully only once, and then essentially garble, incorrect values.
I know im being brief and maybe vague, but hoping someone in the know can point out why this might be happening.
Im thinking (but unsure how to investigate) buffer issues (what happens once its full), timing issues, or some other conflict.
thanks again
MW vs Arduino Serial, difference/problem [solved]
MW vs Arduino Serial, difference/problem [solved]
Last edited by haydent on Fri Mar 14, 2014 11:14 am, edited 1 time in total.
Re: MW vs Arduino Serial, difference/problem
multiwii serial code directly accesses uart, bypassing the shitty tarduino serial library.
they cannot be used at same time, as you've found out.
they cannot be used at same time, as you've found out.
Re: MW vs Arduino Serial, difference/problem
yes, that is understood, and naturally i had to discard the 'tarduino' library for multiwii's just to get it to compile, but as i said, i have the problem with the mw one only reading successfully once...
thanks so much for prompt reply !
thanks so much for prompt reply !
Re: MW vs Arduino Serial, difference/problem
ok, so it does seem to have something to do with the buffer.
if i delay my serial processing function like:
ie allow enough time for buffer to fill and start doing what it does next (is it a ring) ?
then i dont even get to read out 1 succussfull frame...
if i delay my serial processing function like:
Code: Select all
if(millis() < 5000)return;
ie allow enough time for buffer to fill and start doing what it does next (is it a ring) ?
then i dont even get to read out 1 succussfull frame...
Re: MW vs Arduino Serial, difference/problem
im on the trail of it ! if i copy out the data bytes coming in @ Serial.cpp's store_uart_in_buf() function before they get into the buffer, i get good data that reads fine
so its either the buffer process or the serialread() call to it that is disrupting things... investigation continues
so its either the buffer process or the serialread() call to it that is disrupting things... investigation continues
Re: MW vs Arduino Serial, difference/problem [solved]
FFS!
i thought of this hours ago but dismissed it, now it turns out to be what it was ....
crafty mwc will use any 'unused' serial ports for MSP unless it is told otherwise in Protocol.cpp
it was snatching my data packets...
all sorted now, just had to add a condition
i thought of this hours ago but dismissed it, now it turns out to be what it was ....
crafty mwc will use any 'unused' serial ports for MSP unless it is told otherwise in Protocol.cpp
Code: Select all
while (cc-- GPS_COND SPEK_COND SBUS_COND SPORT_COND) {
...
...
c = SerialRead(CURRENTPORT);
it was snatching my data packets...
all sorted now, just had to add a condition