Help with AVR's USB in automotive environment - Page 1
Forum section: electronics / general

author: cmcraeslo
author_rank: Regular Contributor
timestamp: December 20, 2016, 07:55:19 am
content: Hey Guys.I'm having problems with my USB device in automotive environment. I've been struggling around this for a very long time and haven't found any solution yet. My device, when connected to my laptop (everytime I crank the car or push the throttle hard or just randomly), just looses USB connection to my laptop (windows). I need to unplug and plug the USB connector back in and everything works again. The device itself is not powered off and it works without any problem. I'm using the XMEGA192C3 usb driver from ASF and windows drivers that come with the ASF example.I've attached a schematics of my USB connection. Please note that the capacitors C45, C46, C47 and C48 and resistors R45 and R46 are 1mm away from the AVR.Any help and advice would be really appreciated. I'd even pay for a working USB design in this application..

author: Buriedcode
author_rank: Super Contributor
timestamp: December 22, 2016, 03:59:49 pm
content: What exactly is your set up? And what does automotive have to do with it? You mention it disconnects from your laptop... is this inside your car? whilst looking at your car? or whilst being 'powered' by the vehicle ?I'm assuming - from the fact things 'reset' whenever you 'crank' - that you have something powered from the cars electrical system, in which case you will have to deal with large transients, sudden dips well below 12V, and general hellishness. Its a less-than-ideal power supply, so would require heavy filtering, protection, and decent capacitance after a diode to take up the slack.I could be wrong, but your post just reads like you have an issue with USB... that is somehow linked to your car...

author: cmcraeslo
author_rank: Regular Contributor
timestamp: December 22, 2016, 06:30:50 pm
content: Hey. This is actually a shifting control unit that runs in the car and controls the gearbox. Being connected by laptop is for the setup and diagnostics only. There are no other noticable problems (a/d works normally, other functions aswell..), so i am assuming usb itself is a problem.

author: elecman14
author_rank: Unknown
timestamp: December 22, 2016, 09:43:33 pm
content: Sounds to me like you may be having a power supply issue. Without a full schematic of your power supply, it would be probably hard to troubleshoot. Probably not practical but a passenger with a high end scope is always helpful to troubleshoot something like this.Some random thoughts:Try a new usb cable. They do go bad over time. Especially the cheap ones.If you have access to a DMM with a min/max function (like a fluke 87) hook it up across device power and go for a drive. Check out what min is when it crashes. Your hard acceleration may be causing the system voltage to sag.If you are powering this with your car try putting a large value cap >= 1000uF across device power.If you think it is working and you have a brown out register set. Try disabling it and see if the device is just resetting often. If you have spare gpio you could hook up an LED to show when reset occurs.

author: cmcraeslo
author_rank: Regular Contributor
timestamp: December 23, 2016, 07:34:52 am
content: Hey.Device works normally and was tested running more than 24 hours without a glitch (like reseting). I did find some problem with the supply and will try to fix it first and then report (see attachment)Blue is the 3.3V line, yellow is 12V.Thanks

author: Jeroen3
author_rank: Super Contributor
timestamp: December 23, 2016, 08:17:13 am
content: Looks fairly typical for a car. The environment is not nice. There is a reason they use the robust CAN bus for diagnostics!Those common mode spikes on the 3v3 are not normal. But you probably are using the scope with the ground aligator clip?

author: Buriedcode
author_rank: Super Contributor
timestamp: December 23, 2016, 06:39:44 pm
content: So its a circuit using the XMEGA with USB, that's powered form the car. Do you have a schematic of the power supply for this? As noted the drops in the 3v3 line are easily enough to reset things, especially a microcontroller (which will no doubt have brown-out as well).As you say it 'generally works well', then it should just be a case of redesigning/modifying the power supply for this.

author: TheDane
author_rank: Regular Contributor
timestamp: December 24, 2016, 07:52:25 am
content: What I/O's do you have 'out' in the car?- it sounds like a ground current/EMC issue to me. (Fast changes on the alternator/starter generates high currents who needs a place to go (like your I/O's who is clamped to Vcc and Gnd) - the battery has an internal resistance that is much higher when charged, than discharged)A galvanic isolated USB connection might be the best solution - try look intohttp://www.analog.com/en/products/interface-isolation/isolation/standard-digital-isolators/adum4160.html#product-overvieworhttp://www.linear.com/product/LTM2884It's not free, but not all cars are equal - and it might save you a lot in the future, not least your time