2024-04-19 11:54 PM
I am trying to catch a pulse on PB15. So I set the port PB15 to external irq with falling edge as per screen shot below
The code in MX_GPIO_Init() generated by MX is:
/*Configure GPIO pin : MPuls_Pin */
GPIO_InitStruct.Pin = MPuls_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
GPIO_InitStruct.Pull = GPIO_PULLUP;
HAL_GPIO_Init(MPuls_GPIO_Port, &GPIO_InitStruct);
and the code in the call back is a simple test
// External Interrupt ISR Handler CallBackFun
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
if(GPIO_Pin == MPuls_Pin) // INT Source is pin PB15{
// HAL_NVIC_DisableIRQ(EXTI15_10_IRQn);
// Serialprint((uint8_t *) "Hi\n");
if( IRQCheckI > 0) {
IRQCheckI = 0;
sprintf (TempBufCA, "%3d -> ", ++TempCI);
Serialprint(TempBufCA);
}
if ( MotorPosGI > 0) {
MotorPosGI=0;
Serialprint("\nMagnet at position\n");
}
// HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_11); // Toggle LED
}
}
I put a break point on the line if(GPIO_Pin == MPuls_Pin) // INT Source is pin PB15{ but the loop never get accessed by the external event.
Before the upgrade all was working well.
Can any one please assist.
2024-04-20 12:09 AM
Primary check if EXTI in NVIC is checked.
2024-04-20 12:14 AM - edited 2024-04-20 12:15 AM
Yes it is unless I am missing something
If I set the pin to read the IO I do get the level changes but not the IRQ
2024-04-20 12:28 AM
You write update what? I see sometimes on updates is it file empty = code for irq isnt generated.
2024-04-20 01:12 AM
Thanks for you help. I reinstalled the software (cube) and it is working. Something must have gone wrong its working now.
2024-04-20 01:39 AM
I mean uncheck NVIC generate and check back next generate repair this, but this bug i see long time in MX
First generate after update fail produce right files...
2024-04-20 03:21 AM
Many thanks,
I understand what you mean I thought the installation was not good.
Regards