STM32CubeIDE stuck on SysTick_Handler - interrupt

I created a new STM32CubeIDE project for the STM32F030CC mcu. I added a GPIO output port on PA8 to enable/disable an LED. Now I tried to delay the toggle by calling HAL_Delay. But my problem is, that the interrupt SysTick_Handler does not get called.
I am a bit stuck since I found no working solution. Do I need to set up the systick interrupt myself? Or has someone a sample project which works with the STM32F030CC?

i used STM32Cube for stm32f103, and set like your config and it worked correctly
there isn't need to set up the systick interrupt yourself
did you debug your code?
if this lines occur
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000U);
HAL_NVIC_SetPriority(SysTick_IRQn, TickPriority ,0U);
your systick should start with 1ms clock
these code are in HAL_InitTick(TICK_INT_PRIORITY); and it call by HAL_Init();

Related

How to create my own unique interrupt signal and interrupt handler in EFR32FG14

I have an EFR32FG14 evaluation board with the example shown in the end.
where it get triggered by an odd number of pins getting pressed.
I want to change this example (in code) so i get the interrupt be triggered by a single pin ,not odd or even.
I have looked inside the example and i see there two lines
NVIC_EnableIRQ(GPIO_ODD_IRQn);
GPIO_ODD_IRQn = 18, /*!< 16+18 EFR32 GPIO_ODD Interrupt */
Inside the GPIO_ODD_IRQHandle event handler called we have
GPIO_IntClear(0xAAAA);
i want to enable interrupt only for PF7(not even or odd) and write an event handler for it.
Is it possile?Thanks.
datasheet:
https://www.silabs.com/documents/public/data-sheets/efr32fg14-datasheet.pdf
user guide:
https://www.silabs.com/documents/public/user-guides/ug318-brd4257b-user-guide.pdf
code example link:
https://github.com/SiliconLabs/peripheral_examples/blob/master/series1/gpio/switch_led_interrupt/src/main_s1.c
I have learned the interrupt system,and ran close example to what i want shown in the post.
The interrupt numbers are fixed when the silicon chip is manufactured. You can't change them.
To have some action taken on PF7 only you could try to use the odd numbered pin interrupt, and then in the handler check which pin was signalled. If it wasn't PF7, then do nothing.

Issue in implementing capacitive touch in PIC18F26K40 microcontroller using mTouch library

i currently working on PIC microcontroller. I have PIC18F26K40. I want to use CVD (Capacitive Voltage Divider) technique to implement capacitive touch button. I am using mTouch library of MCC (Microchip Code Configurator) library for that. I am doing same as per microchip documentation (links are here and here ). PIC is not detecting the touch. Here is my main method below:
void main(void)
{
// Initialize the device
SYSTEM_Initialize();
INTERRUPT_GlobalInterruptEnable();
INTERRUPT_PeripheralInterruptEnable();
LED_TRIS = OUTPUT;
while (1)
{
if(MTOUCH_Service_Mainloop())
{
/* Button API*/
if (MTOUCH_Button_isPressed(0))
LED_LAT = HIGH;
else
LED_LAT = LOW;
}
}
}
I have some doubts:
What is differential CVD.
What is driver shield. Do i need it?
Do i need to use two analog channels.
I have worked and tested CTMU mode of PIC18F26K22. Is there any way use CVD like CTMU.
If you have any solutions with or without library then let me know.
I am attaching some screenshot of my MCC configurations. Please go through it.
Help needed!
Note:
MPlab IDE: v5.50
Analog pin used for sensing: RB0
Programmer: PICKIT3
I came across your post whilst researching another issue with PIC mTouch on the same MPU you're using (or, rather the low voltage version, PIC18LF26K40). I am also using MPLAB X v5.50 with the mTouch plugin. Just wanted you to know that I was able to set up a single touch button with no problem on this chip, actually compiled and worked on the first try. So, you're on the right track!
You do not need to use the "driven shield" that is presented as an mTouch output (this is for improving signal integrity later when you're concerned about such things, see the various app notes on this). I used the "CS" (capacitive sensor) output only and it works fine.
This video helped me get started: https://www.youtube.com/watch?v=CCW3g9RqpZk
Hope this helps a bit.

(STM32L476RG) Flag setting (osThreadFlagsSet) crashes microcontroller when executed in an Interrupt (GPIO EXTI)

I am currently learning CMSIS-RTOS v2 and I have an issue that is bugging me and I can't find the answer I need.
I am using the STM32L476-Disco board and the joystick center button as an interrupt. I have a very simple Interrupt callback for my center joystick interrupt :
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin){
//osEventFlagsSet(evt_id,0x0001);
HAL_GPIO_TogglePin(LD5_GPIO_Port,LD5_Pin);
osThreadFlagsSet(ThId_Led_Blink,0x0001);
}
When I call osThreadFlagsSet, the microcontroller freezes and nothing else happen. This is why I've put the HAL_GPIO_TogglePin : to see if the mcu was still responding or not.
I know that my interrupt resets correctly because when I only put my pin toggle, I can toggle the Led correctly.
ThId_Led_Blink is a ThreadId
osThreadId ThId_Led_Blink;
I've checked that the ID is set correctly in my debugger and it is (it's not null).
As you can see, I've tried with osEvenFlagsSet and I have the same result.
When I check the CMSIS_RTOS v2 documentation, it does specify that osThreadFlagsSet can be called from an ISR, but I am not sure if I need to do something else in that case for the Flags to be set correctly and resolve the issue when the ISR is hanging.
Thanks for your help
So after frustrating hours of searching, I finally fixed my issue.
As described in this website : https://www.freertos.org/RTOS-Cortex-M3-M4.html, for STM32 microprocessor, you need to set the NVIC Group Priority to 4. If you look on freeRTOS, they are talking about putting this line in your code :
NVIC_PriorityGroupConfig( NVIC_PriorityGroup_4 );
However, the STM32 has it's own library for the NVIC and the correct function to set the priority group is :
HAL_NVIC_SetPriorityGrouping(4);
Why go with the same name when you can change everything?
So make sure to call this function before your kernel initialization if you are using nested interrupts with FreeRTOS/CMSIS RTOS.
Also, make sure that your nested interrupt priority is in the range of configured interrupt priority for your FreeRTOS, otherwise, the osThreadFlagsSet function will fail automatically.

GPIO interrupt for MSP430f2274

i am working on a project in msp430f2274 microcontroller. In my project i am trying to read an reed switch which is being connected to a GPIO pin at P2.3. Normally the pin will remain HIGH as it is being connected to pull up from the hardware. when once the switch is pressed/activated a LOW will come and it will trigger the Hardware. till here it is working fine. but now i want to read the other interrupt also, when it goes back to high. I have tried the interrupt type from low - high to high -low in ISR but still no efffect. please help.
i have added ISR from the code
static char x=0;
#pragma vector=PORT1_VECTOR
__interrupt void PORT1_ISR(void)
{
P1IES^=BIT2;
P1OUT^=(BIT0); // enrer the rest code for detection of door open or close.
P1IFG &= ~BIT2;
//P1IES&=~BIT2;
__bis_SR_register_on_exit(GIE+LPM0_bits); // Enter LPM3 on ISR exit
}
Just an idea, sry if this doesn't help.
You could use a timer that starts with the button click and triggers an interrupt when the button is released.

LPC17xx sleep modes and software reset error when invoked in interrupt

I have a problem with both the sleepmodes and NVIC_reset(), aka software reset.
The problem is present on two totally distinct boards, both with a LPC1769 uC.
If I enter the sleepmode within main() or another function, except an interrupt routine, the sleep mode is working perfecly. The uC wakes also with an external interrupt on EINT0. The reset function does its job also well in the main function.
But when a sleepmode or reset request is invoked inside an interrupt routine trouble starts. The sleep mode lookes to be entered but the uC does not wake up anymore.
E.g. enter a sleep mode with EINT1 and wake with EINT0:
void EINT0_IRQHandler(void)
{
EXTI_ClearEXTIFlag(0);
}
void EINT1_IRQHandler(void)
{
EXTI_ClearEXTIFlag(1);
CLKPWR_Sleep();
}
Anybody a clue why this does not work properly?
Have you checked your interrupt priorities?
34.3.5.2.1 Wakeup from WFI or sleep-on-exit
Normally, the processor wakes up only when it detects an exception with sufficient priority
to cause exception entry.