Lil' Blackbox

Coding => v1.0 - v1.1 => Topic started by: Rx7man on November 09, 2015, 08:26:40 AM

Title: Serial output problems
Post by: Rx7man on November 09, 2015, 08:26:40 AM
Well, I have an issue with the serial output.. it seems as though it suddenly goes out of sync, and outputs gibberish,  I move a coupe things around and it goes away.. I thought the serial buffer in the arduino may be filling up, so I inserted delays, (millis and micros) and it didn't help.. I remove one or two serial prints and it'll go away, even if I add some others later.. very frustrating when you're trying to debug.  my baud rate is 115200
Title: Re: Serial output problems
Post by: hakcenter on November 09, 2015, 08:36:49 AM
What are you outputting
Title: Re: Serial output problems
Post by: Rx7man on November 09, 2015, 10:18:31 AM
A few characters of text (variable name) and it's value

Like this

Serial.println("--------------------------");
if(JakeMode){Serial.println("JAKE ON");}
if(WarmupMode){Serial.println("WARMUP MODE");}
if(Running){Serial.println("RUNNING");}
else{Serial.println("STALLED");}
Serial.print("RT = ");
Serial.println(Runtime);

Serial.print("TB = ");
Serial.println(TargetBoost);
Serial.print("Position = ");
Serial.println(VgtRealPosition);
//}
//else{
Serial.print("Temp is ");
Serial.println(VgtTemp);
Serial.print("TSS = ");
Serial.println(TSS.Value);
Serial.print("RPM = ");

Serial.println(RPM.Value);
Serial.print("MAP = ");
Serial.println(MAP.Value);
Serial.print("EGP = ");
Serial.println(EGP.Value);
Serial.print("TPS = ");
Serial.println(TPS.Value);
Serial.print("AUX = ");
Serial.println(AUX);
Serial.print("Pot = ");
Serial.println(PPT);
Serial.print("DPR = ");
Serial.println(DPR);
Serial.print("EGPV = ");
Serial.println(EGPV);
Serial.print("Nozzle = ");
Serial.println(NozzleSize);

Serial.print("Normal mode position = ");
Serial.println(NormalPosition);
Serial.print("Jake mode position   = ");
Serial.println(JakePosition);
Serial.print("Start mode position  = ");
Serial.println(StartModePosition);

Title: Re: Serial output problems
Post by: hakcenter on November 09, 2015, 02:50:32 PM
Remove the variables and work backwards until you find the culprit.

I know when you get close to memory issues things get pretty wonky.
Title: Re: Serial output problems
Post by: Rx7man on November 09, 2015, 09:56:54 PM
I think the memory must be the issue... probably to do with fragmentation, etc... it's a PITA but I'll find a way to deal with it... I plan on outputting to serial only when asked by the serial client..


BTW.. do you know what I'd need to change to run the lillbb on the Arduino Mega?  I put it on and it won't communicate... that would solve most of my problems.  The Mega has a big USB cable too, which would be more tolerant of being mashed around on the floor of the truck
Title: Re: Serial output problems
Post by: hakcenter on November 10, 2015, 07:15:08 AM
FreqMeasure uses pin 8 on the Uno and 49 on the Mega, you'll have to jump that if you want to use it.

For making the CANBUS compatible on the Mega check this thread post here : http://www.seeedstudio.com/forum/viewtopic.php?f=23&t=5172&start=10#p19723

13 - SCK
12 - MISO
11 - MOSI
10 - CS

cut and jump these respectively.
Title: Re: Serial output problems
Post by: Rx7man on November 10, 2015, 07:20:15 AM
Cool, thanks.   I was thinking someone (Sparkfun? Seeed?) should make a conversion board
Title: Re: Serial output problems
Post by: hakcenter on November 10, 2015, 07:31:27 AM
Not sure honestly. I'm surprised they didn't keep the mega compatible and just add more pins ...
Title: Re: Serial output problems
Post by: Rx7man on November 10, 2015, 02:07:37 PM
:banghead:  is about all I can say about it
Title: Re: Serial output problems
Post by: Rx7man on November 10, 2015, 09:22:03 PM
Got it working on the Mega... pin 10 doesn't need to be cut or jumpered.  I had a Sparkfun Protoboard that I jumpered, and I still have the whole rest of the board to play with.. I clipped the pins on the proto board so I leave the lillbb alone.


this will help me a lot
Title: Re: Serial output problems
Post by: Rx7man on November 10, 2015, 09:23:40 PM
Oh, I will probably be removing a couple pullup resistors on the digital inputs on the lillbb if I use them  as outputs.. TBD