2021-04-30 04:56 AM
Hello,
i'm trying to set up a new project with CAN in Interrupt mode. Therefor i generate a project with stm32cubemx and enabled the interrupt 0 for fdcan1 and also in the NVIC-settings the Interrupt is enabled:In polling mode, i can receive Frames and got no problems. When i try the to use the NVIC, the ISR-Adress is wrong an it don't jump to the generated "FDCAN1_IT0_IRQHandler". The Controller jumps to an undefined Adress:
In the startup_stm32l553cetx.s the spelling of the ISR is correct.
I've tried to get some more informations about the vector table. The ISR for fdcan_it0 should be in 0xbf900dc, the function of NVIC_GetVector gives me the Adress 0xbf97755.
Do you have any idea for a solution?
Greetings
Solved! Go to Solution.
2021-05-03 06:17 AM
So, i get it working right now.
A deeper look in the hex files shows, that the interrupt table is based in the 0x8000000 Adress. So i added
SCB->VTOR == 0x08000000;
This solved the problem.
2021-04-30 07:47 AM
Hi @CSeif.1 ,
Please refer to the STM32CubeL5 under Projects/$board_name$Examples/FDCAN
Best Regards,
Ons.
2021-04-30 08:14 AM
Hello @Ons KOOLI,
thank you for your answer. I checked both files. I didn't use the globalfitler setting.
I try it on Monday and then i can give a feedack,
Best Regards,
Christoph
2021-05-03 04:58 AM
Hello @Ons KOOLI ,
i tried to get any interrupt working today but without success. Therefor i started with a new empty stm32cubemx project, selected the STM32L552CEx controller and enabled the fdcan1 with interrupt on line0
After the code generation i've added the line for start and activate notifications:
HAL_FDCAN_Start(&hfdcan1);
HAL_FDCAN_ActivateNotification(&hfdcan1, FDCAN_IT_RX_FIFO0_NEW_MESSAGE, 0);
__enable_irq();
Up there it worked. When i send a canframe from an external system i see an interrupt pending.
But the controller don't enter the generated function from the cubemx
/******************************************************************************/
/* STM32L5xx Peripheral Interrupt Handlers */
/* Add here the Interrupt Handlers for the used peripherals. */
/* For the available peripheral interrupt handler names, */
/* please refer to the startup file (startup_stm32l5xx.s). */
/******************************************************************************/
/**
* @brief This function handles FDCAN1 interrupt 0.
*/
void FDCAN1_IT0_IRQHandler(void)
{
/* USER CODE BEGIN FDCAN1_IT0_IRQn 0 */
/* USER CODE END FDCAN1_IT0_IRQn 0 */
HAL_FDCAN_IRQHandler(&hfdcan1);
/* USER CODE BEGIN FDCAN1_IT0_IRQn 1 */
/* USER CODE END FDCAN1_IT0_IRQn 1 */
}
So i called the rudimenary function HAL_Delay(10) after the init process from CubeMX. It entered the call but it stuck in this function in the while part
/**
* @brief This function provides minimum delay (in milliseconds) based
* on variable incremented.
* @note In the default implementation , SysTick timer is the source of time base.
* It is used to generate interrupts at regular time intervals where uwTick
* is incremented.
* @note This function is declared as __weak to be overwritten in case of other
* implementations in user file.
* @param Delay specifies the delay time length, in milliseconds.
* @retval None
*/
__weak void HAL_Delay(uint32_t Delay)
{
uint32_t tickstart = HAL_GetTick();
uint32_t wait = Delay;
/* Add a period to guaranty minimum wait */
if (wait < HAL_MAX_DELAY)
{
wait += (uint32_t)uwTickFreq;
}
while ((HAL_GetTick() - tickstart) < wait)
{
}
}
My guess is that something is wrong with the config of the interrupt vector table. VTOR gives me the baseaddress of the tabel, thats 0xBF90000. In the register starting from 0xBF90010, should be the addresses for the specific interrupt. The CAN ISR is the Block 0xBF900DC and thats not the function for the isr.
This address jumps outside the code
It ends up by the error:
Break at address "0xbf97754" with no debug information available, or outside of program code.
I hope you can reproduce the problem or have any idea for the config of the isr table.
Best regards,
Christoph
2021-05-03 06:17 AM
So, i get it working right now.
A deeper look in the hex files shows, that the interrupt table is based in the 0x8000000 Adress. So i added
SCB->VTOR == 0x08000000;
This solved the problem.
2023-05-18 05:11 AM
Where did you add the line ?
2024-01-31 05:28 AM
Sory if the question looks trivial but I'm new into stm32.
Where sould I write this line of code?