简体   繁体   中英

Access of register STM32 CAN communication

你能帮我弄清楚这条线的作用吗:

while (hcan->Instance->MSR & CAN_MSR_INAK) != CAN_MSR_INAK)

It is the common way to check flags or more precisliy - if bit is set in some register. In this particular example:

INAK: Initialization acknowledge This bit is set by hardware and indicates to the software that the CAN hardware is now in initialization mode.

So you are basically wait in the infinite loop until CAN enter initialization mode.

BTW. I think you have way to much structures in your CAN configuration. If you use CMSIS macros package, it should look like this:

while((CAN->MSR & CAN_MSR_INAK) == 0);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM