Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
8 years, 12 months ago.
Interruptin for Nucleo stm32L4
I tried the Nucleo_read_button_interrupt on nucleo stm32l476RG. when I exported the program and debugged it in Keil, the interrupt does not seem to work. I opened the Exti example in the CubeL4 and the interrupt is working.
Is there an incompatibility problem here? I do not know how to debug from mbed online compiler.
Can I mix mbed code with the code from the CubeL4 by copying the interrupt section into my main.c?
1 Answer
8 years, 12 months ago.
It does work Mbed, just tried. Make sure you have updated to the latest Mbed library, current working revision is 112.
Forgot to mention, there is a bug in the ST-Link firmware.
Any interrupt code running on the L476 targets can cause the ST-Link not to connect when downloading a new program. Cycle to power to the Nucleo so the interface LED is 'RED', then download again.
THX, I will try it after work, and will let you know...Appreciate your pointers
posted by 20 Jan 2016I tried and still seems not to work (the rate of blinking is constant.) I have stm32F446 Nucleo, and tried the same test for the F446 board and it does work. I thought that maybe I damaged the L476 board, but then why is the interrupt working with examples from stm32cubel4 (the EXTI ... The LED toggles when User button pressed
posted by 20 Jan 2016Yes, they have cocked it up again. I was trying the wrong example (necleo_read_button).
However Nucleo_read_button_interrupt does work if you load Mbed-dev rev: 33.
Current Mbed-dev revision: 58 and Mbed revision: 112 is no good.
Wonder what else is not working :(
I have report bug on Github.
posted by 20 Jan 2016Thx for the valuable input.... Do you have any idea how I can get the Mbed-rev:33..... I have mbed rev 112.... I am going to test the ADC next :):):)
posted by 21 Jan 2016Do not know why but adding the AnalogIn pin define makes it work. Use the latest Mbed libs, they work. This stems from the original code. I was using AnalogIn in my code so that is why it was working for me.
I have sent a bug report.
TEST
#include "mbed.h" InterruptIn mybutton(USER_BUTTON); DigitalOut myled(LED1); AnalogIn aIn(PA_1); // dummy pin define not needed but allows InterruptIn to work. float delay = 1.0; // 1 sec void pressed() { if (delay == 1.0f) delay = 0.2; // 200 ms else delay = 1.0; // 1 sec } int main() { mybutton.fall(&pressed); while (1) { myled = !myled; wait(delay); } }
Have you tried to run the program using the mbed compiler?
posted by David Fletcher 19 Jan 2016Thx David, Yes, I compiled under mbed, and copied it to the board, same results
posted by Stan Bouli 19 Jan 2016Sorry Paul, I pressed the wrong selection.. tried your suggestion and copied the analogin line. on reset the led blinks, when I press the user button, the led is off and nothing happens till I reset the board.. thx anyway
posted by Stan Bouli 27 Jan 2016