cancel
Showing results for 
Search instead for 
Did you mean: 

Why is my code sometimes running sometimes not ?

antonius
Senior
Posted on October 08, 2013 at 01:50

Guys,

Why is my code sometimes running sometimes not ?

When I plug in J-Link, it's stable but if I plug it out, it's not stable ??

Is it because a power supply from USB ?

Any ideas ?

Thanks
14 REPLIES 14
Posted on October 08, 2013 at 02:36

The universe of problems is pretty large, I could get my magic eight ball out?

If you think it's a supply issue, then use a bench supply, and observe current draw.

Track down what happens when the debugger is not attached, output diagnostic information via a serial port, or identify progress with GPIO or LED. Make sure you have a Hard Fault handler that can output data about faults.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
antonius
Senior
Posted on October 08, 2013 at 13:01

or because I left my boot 1 hanging ?

I boot from flash...

antonius
Senior
Posted on October 08, 2013 at 13:03

with LED blinker test it's stable, I'm using 2.4'' LCD, could it be the cause ? I have less power to turn it on ?

Now it's on after trying to reset few times....

frankmeyer9
Associate II
Posted on October 08, 2013 at 17:15

Power consumption can be a problem with LCD displays. Supplying by USB might not be sufficient, as I can confirm. But that should be easy to find out.

LCD displays need relatively long delays at startup, to ramp up internal voltage converters - up into hundreds of milliseconds. Check the datasheet of your display. They usually provide an example initialization sequence, which you can compare with your code.

jj2
Associate II
Posted on October 08, 2013 at 23:36

Appreciate all advice thus far - but perhaps this, ''When I plug in J-Link, it's stable but if I plug it out, it's not stable'' deserves further regard?

If that probe attachment improves things - as you state - might that suggest inadequate Reset circuit handling and/or JTAG pins not properly, ''pulled-up?''  Thus - w/JTAG probe present - those connections/signals are rendered ''proper'' - and when absent - improper connections assert... 

To remove ''inadequate power'' from the mix - suggest that you open the connection to Lcd's backlight - likely the biggest power-hog on your board - and see if issue resolves...
antonius
Senior
Posted on October 09, 2013 at 01:43

I put 10uF capacitor on VDD3,as suggested on datasheet and I call it stable now, not sure....but everytime startup, I must push reset button few seconds to make it on...I'm using external power supply now

The first time I applied power supply, LCD was off, I need to push reset button about 1 second to make it on, any ideas why ?

Please have a look on my reset and JTAG circuit, in case I need a fix on it, thanks

________________

Attachments :

STM32F103V.pdf : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I07u&d=%2Fa%2F0X0000000baT%2FdXSDV2fn9ZU.1ZLAaJRHwN_QoR1Rqe9FnQc8jd_FdX4&asPdf=false
antonius
Senior
Posted on October 16, 2013 at 00:32

If I'm using USB as power supply, it's not easy to on it, even I push reset button so long..

but if I'm using 1A transformer, I can make it start after pushing the reset button for a few seconds, is it because of the LCD consuming a lot of power ? I'm using 2.4'' LCD with ILI9325 controller...

thanks

antonius
Senior
Posted on October 16, 2013 at 00:48

I'm gonna use Amp meter to see the current draw.....and get back to you guys...

It's 132 mA on 5V input, I'm using 1A transformer and LCD backlight is on, I need to push reset button for few seconds to make it on and stable.....any ideas why ?

thanks for the suggestion

jj2
Associate II
Posted on October 16, 2013 at 22:37

Your first post stated, ''When I plug in J-Link, it's stable but if I plug it out, it's not stable ??''

Does this, ''JLink connection'' continue in making things stable?  (appears it does not - from the bulk of your follow-on writings)

As others have stated - LCD Controllers - upon power-up - often require an unusually long time to become, ''Ready.''  Does your MCU Reset process also reset the LCD Controller?  If it does not - that added ''MCU-only'' Reset may provide the added time required by your LCD...

Many LCD Controllers may ''signal'' their ''readiness'' to accept initialization & data.  Your compliance w/this is an ideal means to gain stable & repeatable LCD operation...