STM32G431 FDCAN Why ir ARA (acces to reserved address) is firing after enabling FDCAN1 clock?
Hi,
I am developing a device which uses CAN interface. My code is 'bare metal'. I am using arm-none-eabi combined with cmake and vscode. Assembly and CMSIS are taken from cube generated project.
The problem is that immediatly after setting RCC_APB1ENR1_FDCANEN bit the FDCAN_IR_ARA bit is set by hardware. The code is very simple:
void main()
{
RCC->CCIPR &= ~RCC_CCIPR_FDCANSEL;
RCC->CCIPR |= RCC_CCIPR_FDCANSEL_1;
RCC->APB1ENR1 |= RCC_APB1ENR1_FDCANEN;
FDCAN1->CCCR |= FDCAN_CCCR_INIT;
//here the FDCAN1->IR ARA bit is setted
while ((FDCAN1->CCCR & FDCAN_CCCR_INIT) != FDCAN_CCCR_INIT)
;
FDCAN1->CCCR |= FDCAN_CCCR_CCE;
FDCAN1->CCCR |= FDCAN_CCCR_DAR;
FDCAN1->CCCR |= FDCAN_CCCR_PXHD; // Protocol exception handling
FDCAN1->NBTP = 0x100403;
}
I was not able to reproduce this error in STM32CubeIDE. I've pasted same lines to the empty project and it worked. Therefore i must by not doing something that CubeIDE is. I read through HAL library for FDCAN and I am pretty sure that this code should work.
Any ideas?
