cancel
Showing results for 
Search instead for 
Did you mean: 

INAK bit is not getting clear in STM32F407 discovery board

rohitkumarkv07
Associate III

Hello,

In my STM32F407 discovery board, I want to run can communication for which firstly I set the INRQ bit CAN_MCR register then my INAK bit in CAN_MSR register is also got set by the hardware. Then for starting the can I want to clear the initialization mode in CAN_MCR register in which my INAK bit didn't got clear which is supposed to got clear. In the CAN_MSR register there is RX register is got cleared by the hardware which is also supposed to get set. Is it affect my Can start part or not.

Kindly help me in this part.

 

REG_RMW32(CAN_MCR_ADDR32,CAN1_INRQ_MASK,MCR_INRQ_SET);

//delay(1000);

while ((REG_READ32(CAN_MSR_ADDR32) & CAN_MSR_INAK) == 0U)

I have set the INRQ bit without using delay then my INAK bit got set.

 

// Request to leave initialization modeREG_RMW32(CAN_MCR_ADDR32,CAN1_INRQ_MASK,MCR_INRQ_RESET);

// Wait until initialization mode is exited

while ((REG_READ32(CAN_MSR_ADDR32) & CAN1_INAK_MASK) != 0U)

In this part I want to clear the INRQ bit but my INAK bit didn't got clear.

B.R

Rohit Kumar

 

3 REPLIES 3
rohitkumarkv07
Associate III

Hello all, 

I post a query regarding STM32F407 discovery board yesterday. Still I didn't get any response from your technical support team.

Kindly help me out as soon as possible.

B.R

Rohit Kumar

Hello,

You can inspire from the HAL and see the call sequence to implement your own driver: https://github.com/STMicroelectronics/stm32f4xx_hal_driver/blob/d232197f12c592d87944f0f462b2d5297750f762/Src/stm32f4xx_hal_can.c

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

Try to play with CAN registers in debugger. Can you set/clear bits as you expect there?

Do you have CAN clock enabled in RCC?

Double-check the macros and values of symbols you are using. What would be the reason to use a different symbol to check the same bit in the two different instances (after setting and after clearing)?

JW