Strange uart behaviour on previously stable project

Discussion about the ZBasic language including the System Library. If you're not sure where to post your message, do it here. However, do not make test posts here; that's the purpose of the Sandbox.
FFMan
Posts: 502
Joined: 09 January 2010, 12:52 PM

Strange uart behaviour on previously stable project

Post by FFMan »

I have a long term stable GPS lap timer project based on a 128a1 processor that has been solid for 2 or 3 years now, used about 30 times a year to do predictive lap timing in a race car.

From the beginning of the season I experienced some issues with the lcd displaying corrupt characters. I thought I had nailed it when I found the engine builder had put non-resistive spark plugs in during the winter rebuild (this was also affecting the in car video). I change the plugs and the video was fine but I still got display issues.

I then pulled apart the 8 way binder 712 lcd connector and remade it. I thought I had found the issue there as the gnd wire appeared to be detached, but maybe it just became detached as I took it to bits.

I then tried reducing the serial speed from 115200 to 57600 to the lcd but it made little or no difference.

The problem is only seen in the race car when the engine is working under load, static revving of the engine does not produce the effect. Load on the engine will increase the strength of the spark as I understand it.

I ran a test where I left it running even though the display was corrupt and in the summary file it produces I noticed it was reporting (never seen before) checksum errors on the incoming nmea record. So now I have corruption in 2 separate com channels it seems.

I have a new unused cpu on the Sparkfun break out board (now annoyingly discontinued) but replacing it is non-trivial, and I wonder if there are other sensible steps to take first. Could the crystal be running out of spec, there is very little other compentry really.

The problem is either air-borne interference related or vibration related from tests to date but this might not be conclusive as testing in the right conditions is hard to achieve.

Something has changed somewhere for sure.

Any ideas appreciated
FFMan
Posts: 502
Joined: 09 January 2010, 12:52 PM

Post by FFMan »

I think its holiday time for for Don - we all got to have one some time.

I started ensuring I knew where all the wires went before I started the cpu swap. in doing so, I discover one of the caps on the crystal is mostly adrift from the crystal side, probably vibrating on/off at times.

Is this a likely culprit to my uart issues or do I press ahead and swap the cpu ?
DocJC
Posts: 112
Joined: 16 March 2006, 6:23 AM
Location: Cleveland, OH
Contact:

Post by DocJC »

I would think the first step is to try to determine if the interference is EMI, (RF), entering the wiring harnesses, noise on the power supply bus, noise on other input signals, the clock frequency, or of other etiology.

Regarding the cap on the Xtal, If the system was stable and error free for several years, and soldering the cap down solves the problem, then call it a day and move on.

Otherwise just run a simple test program that outputs the uC's clock on a I/O pin, and look at it with an O'scope of a frequency meter. Simple check it with and without the cap soldered down and see the difference. I don't know how big the difference will be. If the clock is within 2% of the expected baud rate, then the USART would be expected to work fine, from this perspective. (Could still have software issues, etc.)

Vehicles are known for having very noisy electrical buses and having Load Dump issues.

Is the project running from the vehicle's power supply?

If so, then are you using a heavily filtered, and load dump protected, power supply?

Do you have other inputs attached to the vehicle and the uC's board, (e.g. voltage monitor, RPM signal, anything tied to the vehicle's power supply in any manner)? If so, each of those connections need to be filtered and over voltage protected for reliable operations within a vehicle.

Are your off-board wiring connects within a shielded cable?
One can argue about how to ground a shield, but for starters I would have all such wires within a shielded cable, and connect the shield at only the PCB end of the shield.

"Worse when running "under load"."
They implies to me that it is worse when running under non-idle RPM's.
At what RPM does the vehicle's alternator kick in and start charging the battery and powering the bus, instead of the battery powering things?
Could it be the alternator is generating (more) noise when under load?

Lots of items to sort out.

JC

Edit: Swapping the uC would be very low on my list of items to check / test.
FFMan
Posts: 502
Joined: 09 January 2010, 12:52 PM

Post by FFMan »

thanks for the considered reply. To cover a few points quickly:-

the project is self contained and self powered, no connection to the car at all.

the vehicle doesn't have an alternator, total loss electrical system.

> They implies to me that it is worse when running under non-idle RPM's.

its not just non-idle, its under under heavy load, like acceleration. Just revving it up does not produce the problem. So its not reproducible easily is the other issue. Its a track only car and my drive isn't bog enough for runs under load. Scoping signals is therefore not really possible.

It all used to work so am looking for new issues. I have for now fixed the caps issue and next race is last weekend in Aug so i'll report back.

The project is housed in a metal case, would binding this to vehicle ground or even project battery ground be worthwhile. it never was but it feels as if it might be an improvement, or will then rfi shield by the case be transmitted into the project psu ? i.e. might make things worse.
twesthoff
Posts: 247
Joined: 17 March 2006, 6:45 AM
Location: Fredericksburg, VA

Post by twesthoff »

What sensors or inputs do you have connected to the circuit. I assume a GPS module, anything else?

You said the display was garbled, can you tell if the circuit is actually working but just hard to read?
rosariote
Posts: 39
Joined: 22 July 2007, 10:12 AM

Post by rosariote »

Hi,
Do you have a 0.1uf capacitor as close as possible to the voltage input pin of the micro? I have a problem similar your problem and found out I was missing the .1uf capacitor at the voltage pin of the micro.
FFMan
Posts: 502
Joined: 09 January 2010, 12:52 PM

Post by FFMan »

Sorry for the delay in responding - been on holiday somewhere with zero coverage !

Only sensor inputs at the moment are gps, there are other optional input bit all have been disconnected to eliminate from the issue.

The caps on the crystal are close to the pins if that's what you are asking, like 5mm or so really, and that was where the dodgy solder joint lay.

Opportunity to test 1 week tomorrow. If that fails i'll swap the cpu.
rosariote
Posts: 39
Joined: 22 July 2007, 10:12 AM

Post by rosariote »

Hi,
No, I was referring to the Vcc voltage pin. You need a .1uf capacitor as close as possible to the pin.
DocJC
Posts: 112
Joined: 16 March 2006, 6:23 AM
Location: Cleveland, OH
Contact:

Post by DocJC »

Rosariote was talking about By-pass caps.

The issue is that the M128 has two Vcc and an AVcc pin.
ALL of them need to be connected to Vcc.
All three of the Grounds need to be connected to Ground.
Both of the Vcc and the AVcc pins should have a By-Pass cap, typically a 0.1 uF cap placed as close to the micro's pins as possible.

If you were using the ADC or the AC, then it would make sense to connect AVcc to Vcc through an LC filter, (not an RC filter), otherwise just tie it to Vcc and add a By-Pass cap to Ground.

You additionally might want to add a 4.7K or 10K pull up resistor to the Reset pin, with another 0.1 uF cap to Ground. Than will improve the noise immunity of the Reset circuitry, which has a weak, internal, pull up resistor.
Adding that might give some programmers a hard time programming the uC.

(True Atmel programmers shouldn't have a problem with 10K/0.1uF on the Reset pin.)

How/were is the GPS with respect to the uC?
If it is outside the box, distant to the uC, is it connected via a shield cable?

JC
FFMan
Posts: 502
Joined: 09 January 2010, 12:52 PM

Post by FFMan »

all sound like very sensible suggestions, but I keep coming back to the fact it has worked for nearly 3 years without these issues, so amending the design, whilst to recommended standards would not appear to be indicated at this stage. I'd like to get back to a stable known point before making modifications although most sound like they should be planned in anyway.

We'll see how the fix performs this weekend.
twesthoff
Posts: 247
Joined: 17 March 2006, 6:45 AM
Location: Fredericksburg, VA

Strange uart behaviour on previously stable project

Post by twesthoff »

Putting the 0.1 if caps on power pins should be done regardless if not already in your circuit.


Have you changed the battery brand or type you are using?

On Aug 24, 2015, at 6:12 AM, ZBasic <zbasic.forum@zbasic.net (zbasic.forum@zbasic.net)> wrote:

all sound like very sensible suggestions, but I keep coming back to the fact it has worked for nearly 3 years without these issues, so amending the design, whilst to recommended standards would not appear to be indicated at this stage. I'd like to get back to a stable known point before making modifications although most sound like they should be planned in anyway.

We'll see how the fix performs this weekend.




FFMan
Posts: 502
Joined: 09 January 2010, 12:52 PM

Post by FFMan »

same battery - 2s lipo - have checked the condition and all seems good.

will apply the caps as suggested. to be clear .1 between any unused ground and/or VCC pins on the processor board and ground

thanks
DocJC
Posts: 112
Joined: 16 March 2006, 6:23 AM
Location: Cleveland, OH
Contact:

Post by DocJC »

will apply the caps as suggested. to be clear .1 between any unused ground and/or VCC pins on the processor board and ground
?
ALL of the Vcc and Ground pins on the micro are used.
None of them should be left unused, (unconnected).
The issue is that the M128 has two Vcc and an AVcc pin.
ALL of them need to be connected to Vcc.
All three of the Grounds need to be connected to Ground.
Both of the Vcc and the AVcc pins should have a By-Pass cap, typically a 0.1 uF cap placed as close to the micro's pins as possible.
And yes, the By-Pass caps go from the Vcc and AVcc pins to Ground.

JC
FFMan
Posts: 502
Joined: 09 January 2010, 12:52 PM

Post by FFMan »

the project is based on one of these

https://www.sparkfun.com/products/retired/9546

as you can see it has 2 ground pins and I need to check that both are connected.

The avcc is used as it has a battery level monitor function.

thanks
rosariote
Posts: 39
Joined: 22 July 2007, 10:12 AM

Post by rosariote »

Hi,
I checked the schematic for your micro Xmega100 and never mind about the capacitors. They are already been installed in the Xmega100 board. Happy camping.
Post Reply