Associate
March 27, 2015
Question
Problem with CAN on NUCLEOF091RC Board
- March 27, 2015
- 2 replies
- 872 views
Posted on March 27, 2015 at 18:29
Dear all,
I'm currently trying to work around the CAN bus on the NUCLEOF091RC board, with the STD_Peripheral library. I have been facing some issues with the Can_Init function. It returns the following status: CAN_InitStatus_Failed After some research and tests, I found out that after setting the INRQ bit to 0 in order to leave Init mode, the INAK bit is never reset by hardware. I did the following modification to the code in the stmf0xx_can.c file for debug purposes (lines 280-295):/* Request leave initialisation */
CANx->MCR &= ~CAN_MCR_INRQ;
/* Led on */
GPIO_WriteBit(GPIOC, GPIO_Pin_11, Bit_SET);
/* Wait the acknowledge */
wait_ack = 0;
while
(((CANx->MSR & CAN_MSR_INAK) == CAN_MSR_INAK))
// && (wait_ack != INAK_TIMEOUT))
{
wait_ack++;
}
/* An other led on */
GPIO_WriteBit(GPIOC, GPIO_Pin_12, Bit_SET);
As you can guess, the second led never brights up.
Please find attached my source code.
Also, I use pins PB8/9 as I'm not sure that I can use PA11/12 since they seem to be used for USB on Nucleo.
Did anyone of you succeeded in working around the CAN bus on stm32F091? Did you encounter similar issues?
Thank you for your answers!
#can-stm32f091-can_init