Modification of mbed-src library only for STM32F030F4, very cheap microcontroller in 20-Pin TSSOP package, with 16Kbytes of Flash and 4Kbytes of Ram.
**Target for online compilator must be Nucleo 32F030R8.**
Dependents:
STM32F031_blink_LED_2
4 comments:
Ok, I believe I have identified what may or may not be a problem, but it at least requires a work around.
1) if using ST-LINK/V2 to program your chip then you must disconnect the ST-LINK/V2 from your chip in order to enter sleep mode (fair enough since the ST-LINK/V2 is probably triggering interrupts by communicating with the chip). However in addition to disconnecting the ST-LINK/V2 from my chip I also had to reset my chip before the chip would enter sleep mode.
2) a second issue that caused me problems is that the function disable_irq() appears to disable interrupts perfectly well however enable_irq() doesn't appear to re-enable them. Again I'm not sure if this is to do with the software or if it is a hardware issue. when I look at the comments in the code they say it depends on hardware implementation.
/ Enable IRQ. This method depends on hw implementation, might enable one
- port interrupts. For further information, check gpio_irq_enable().
- /
Yes, there is a problem. My attempts with the same program had the same result. Deepsleep looks OK, but Sleep is not working. The program goes through Sleep every time.
Since my library is based on the mbed-src v89 (little old), I was looking for further modifications Sleep function at a low level, in newer versions. But I have not found anything interesting.
Then I tested the normal Nucleo F030R8 for comparison. And surprise. I imported the original demo of STM: https://developer.mbed.org/teams/ST/code/Nucleo_sleep/, and Sleep worked perfectly. But the demo was accompanied by an very old version of mbed libraries. When I upgrade it to the new version, the program was not working. When I downloaded version intermediate between that which worked well, and the latest ... Sleep function had become "transparent" in the same way as in the library 030F4.
So I think it's not a problem with this particular type of chip, and it worked fine once before, but someone broke.
I'm searching now old sources of library mbed-src, for changes have caused this error.
Interrupt of hardware timer that supports e.g wait(), Timer class, resulted in an immediate exit from the sleep state. Corrected.
I have tested corrected version, and now it looks good.
hi I'm new to mbed I can not get to sleep STM32F030F4 you can give an example of how to get to sleep and Wake up
Ok, I believe I have identified what may or may not be a problem, but it at least requires a work around.
1) if using ST-LINK/V2 to program your chip then you must disconnect the ST-LINK/V2 from your chip in order to enter sleep mode (fair enough since the ST-LINK/V2 is probably triggering interrupts by communicating with the chip). However in addition to disconnecting the ST-LINK/V2 from my chip I also had to reset my chip before the chip would enter sleep mode.
2) a second issue that caused me problems is that the function disable_irq() appears to disable interrupts perfectly well however enable_irq() doesn't appear to re-enable them. Again I'm not sure if this is to do with the software or if it is a hardware issue. when I look at the comments in the code they say it depends on hardware implementation.
/ Enable IRQ. This method depends on hw implementation, might enable one