When I use STM32F042F6P6 for initialization, it doesn't come out here, and IO is redirected to PA11 and PA12. Why?
while (((CANx-> MSR & CAN_MSR_INAK) == (uint16_t) CAN_MSR_INAK) && (wait_ack! = INAK_TIMEOUT))
{
wait_ack ++;
}
Who can teach me?
Printable View
When I use STM32F042F6P6 for initialization, it doesn't come out here, and IO is redirected to PA11 and PA12. Why?
while (((CANx-> MSR & CAN_MSR_INAK) == (uint16_t) CAN_MSR_INAK) && (wait_ack! = INAK_TIMEOUT))
{
wait_ack ++;
}
Who can teach me?
This is the initial setting:
static void CAN_GPIO_Configuration (void)
{
GPIO_InitTypeDef GPIO_InitStructure;
SYSCFG-> CFGR1 | = SYSCFG_CFGR1_PA11_PA12_RMP; // RMAP
RCC_AHBPeriphClockCmd (RCC_AHBPeriph_GPIOA, ENABLE);
/ * CAN1 Periph clock enable * /
RCC_APB1PeriphClockCmd (RCC_APB1Periph_CAN, ENABLE);
GPIO_PinAFConfig (GPIOA, GPIO_PinSource12, GPIO_AF_4);
GPIO_PinAFConfig (GPIOA, GPIO_PinSource11, GPIO_AF_4);
/ * Configure CAN pin: RX * / // PA11
GPIO_InitStructure.GPIO_Pin = CAN_RX;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
GPIO_Init (GPIOA, & GPIO_InitStructure);
/ * Configure CAN pin: TX * / // PA12
GPIO_InitStructure.GPIO_Pin = CAN_TX;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init (GPIOA, & GPIO_InitStructure);
}