Code only runs fully with USB plugged in - SOLVED
-
Has anyone else experienced this:
I have some code which will run fine in the REPL as snippets, it will run fine as main.py (with USB serial connected), but when I try to run it without the USB plugged in, it just stops part way through. As I don't have the USB connected I can't see error messages or exactly where it fails.
-
SOLVED - I powered the stepper motor separately and all is good. I'm guessing there were transient demands in excess of the 800mA I could measure that were causing problems.
-
@smssms
It would be nice to see how it is connected
Because if you power the motor and microcontroller from a single source then you must fight with disturbance
Some ceramic condenser, diode, RC/LC, etc.minimal protection will be diode:
some hint also:
-
@livius @jmarcelino
Ah, I see.
Tried that and yes, the code seems to run ok with the stepper unpowered.
-
@smssms
i suppose that @jmarcelino mean do not remove it from code
only disconnect it from power source
-
@jmarcelino
Yes, this is the annoying thing:
If I take the stepper motor out of the equation (commenting it out) the rest of the code seems to run ok.
But, it can run the stepper, it does so in the first 1/3 of main.py consistently with no problem.
-
@smssms
Have you tried running it without the stepper motor working (i.e. motor disconnected from power)
-
@jmarcelino
Yes, the DC/DC is on a breadboard and jumpered across to the WiPy Expansion Board.Don't have the parts here now to try comms only, but will look into it - thanks.
When it is running without USB (before it fails), I can get the code's serial output over Telnet, but there is never an error message when it stops...
-
@smssms
Interesting setup thanks.So the DC/DC converter is mounted on a separate board which then powers the WiPy on the expansion board or do you have a custom board for the WiPy?
Can you connect some cheap FTDI-style USB - Serial TTL (@3.3v) adapter to the TX + RX + GND pins on the WiPy in order to get the serial output without powering the board too?
-
@jmarcelino
XP JCJ1012S05 1.5A 5V output DC/DC converter into Vin/Gnd Plus 10uF capacitor for smoothing as it also has to run a stepper motor. The max. draw is only 800mA, so well within the supply's limits. The stepper motor is running in the first 1/3 of main.py too with no problems. But without USB, it just seems to hit a point where it freezes with no error messages (that I can capture).http://uk.farnell.com/xp-power/jcj1012s05/converter-dc-dc-10w-5v/dp/1637871
-
@smssms
What's powering it when not connected to USB?
-
@smssms
I2C have still issues it is software implementation.
We wait for new firmware version where it will become hardware.
@daniel say somewhere it is near finished
-
Good tip - thank you.
I've had a stab at the try: except: to write exceptions to the SD card, but nothing seems to go there.
I'm starting to thing it is some sort of power supply issue i.e. it is only working with USB power available. But it is strange that it fails part way through the code, it can run boot.py and the first 1/3 of main.py.
Seems to fail about when it has to read I2C or go into a for loop...
-