Hi.
I have a problem HW-resetting an external HW-circuit on my PCB (my MCU is STM32F107):
Because the POWER to my HW-circuits arrives later that to my MCU, I need to (re-) generate a delayed RESET-signal from my MCU towards the RESET-pin of the external HW-circuits.
Q-1: Is there a ”RESET-instruction” (assembly code) that I could use to generate this (common) RESET signal?
Q-2: Is there a way (assembly code) to detect the “reset cause” to avoid repeating (indefinitely) this reset-sequence (the RESET must be done only once)?
Q-3: Or is there an alternative way of achieving this (without modifying the HW by using a GPIO)?
Best Regards
Terje Bøhler
Describe in more detail your problem, provide the arangement of your devices.
The attached drawing should explain it better.
Best regards
I guess that picture was not possible to interpret. I try once more (bigger picture attached).
My point is that:
1) At MCU startup after power-on (causing MCU to start many milliseconds before the "external HW circuit") must cause the MCU to force a delayed RESET/NRST to the "external HW circuit" to ensure a proper reset og the external HW curcuit.
2) That RESET/NRST will also (?) cause the MCU to restart once more (I think).
3) That new, sub-sequent MCU restart, must then NOT cause a new RESET/NRST to be asserted (causing new MCU restart indefinitely)
4) So, my code needs to apart (differentiate) these two different kinds of restarts (power-on restart versus restart caused by the MCU asserting a low RESET/NRST) ...
If I correctly understood you want apply power-on-reset to your MCU and then generate another reset from your board to another external circuit, in such case you have to generate this reset via GPIO, because NRST pin is used to force reset MCU externally.
Thanks Vanhealsing.
Yes, I can use GPIO, but then we must modify our HW which we try to avoid. So:
In short:
Other MCUs I have been working with included an assembly instructions named "RESET" (or similar).
By executing this instruction, the MCU turn its NRST pin to an output-pin, and generates a low NRST/RESET signal (to reset all devices connected to this common RESET/NRST bus). I think It also would reset the MCU itself.
Next, when the MCU is (re-) started, the MCU could execute another assembly instruction which detects the "cause of reset". In that way we could distinguish a "power-on-reset" from a "MCU-forced-reset" (caused by this assembly instruction).
Are there two similar assembly instruction for ARM Cortex-M3 as described in 1 and 2 above?
Terje Bohler
Hi there,
The Cortex-M3 processor itself does not have any instruction to trigger nRST pin directly. Since different chips have different reset circuits, different reset sources (e.g. different types of watchdog, brown out detector), these type of reset control and reset reporting mechanism has to be defined by chip designer (i.e. ST in your case).
The architectural feature to allow software to generate reset is SYSRESETREQ (System Reset Request). In C programming you can use CMSIS-CORE function NVIC_SystemReset(). This reset the microcontroller system, but does not trigger nRST unless ST add additional feature at chip level to support this.
regards,
Joseph
Thank you Joseph.
So, a smal HW-mod is required (I must use a GPIO pin for the job) ...
Best RegardsTerje Bohler