cancel
Showing results for 
Search instead for 
Did you mean: 

Sawtooth waveform on NRST

Robert Kong
Associate II

I have been using a STM8S105 successfully for a few months and recently, I have been experiencing problems with i/o on UART2. When I eventually probed the NRST pin I noticed that there is a sawtooth waveform on that pin, with no other circuit connected to the NRST pin.

Has anyone seen this before and/or has an idea what is causing this? I am wondering if the MCU is executing bad code and which is causing it to reset - but why a sawtooth?! No watchdog is enabled.

4 REPLIES 4
nestor
Associate II

Maybe an illegal opcode?

You can put a while (1) in the interrupt handler

Does the waveform change if an aggressive pull-up is added to NRST circuit?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
DMore
Associate

Hi Robert

Could you find the solution to your problem? I'm facing the same trouble.

Any suggestion is welcome

Robert Kong
Associate II

Hi Daniel, it has been a while, but I believe I concluded that the MCU was executing an illegal opcode (as nestor suggested) as at that time I was writing my own small-C compiler for the STM8S and I noticed that there was a bug in the code generated that would cause the MCU to jump to the wrong location on reset under some conditions.

I would suggest that you write some simple code to show that the symptom does not appear and progressively include more and more of the code you are using. What I did myself was to move a loop in the body of main() until I found a point where the STM8S stopped behaving as expected. If UART is part of the problem the loop toggles an IO line but if UART is working, the loop includes both toggling an io line and echoing anything coming in on the UART, that way I can use a logic analyser (you can get a cheap one on aliexpress) and/or a serial terminal to find out at what point the trouble appears.

Please let me know what you find.