初级会员

- 积分
- 58
- 金钱
- 58
- 注册时间
- 2014-9-4
- 在线时间
- 1 小时
|
5金钱
请问一下各位大神 我用stm32f103zet6 做的智能卡协议 为什么在stm32f103c8t6上面不可以用??不是串口管脚号 时钟什么都一样吗?请问一下 还有什么要注意的啊?stm32f103zet6 用的是串口3 ,stm32f103c8t6用的也是串口3 ,还是说stm32f103c8t6这个串口3 不支持智能卡协议吗?
不过stm32f103zet6这个我用的是144脚,stm32f103c8t6用的是48脚的,stm32f103c8t6 这个板不是我的,就是一个最小系统板,只是把所有管脚接出来了 ,原理图丢了
GPIO_InitTypeDef GPIO_InitStructure;
USART_ClockInitTypeDef USART_ClockInitStructure;
USART_InitTypeDef USART_InitStructure;
RCC_APB2PeriphClockCmd(SC_USART_GPIO_CLK | RCC_APB2Periph_AFIO, ENABLE);
RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3,ENABLE);
/* Configure USART CK pin as alternate function push-pull */
GPIO_InitStructure.GPIO_Pin = SC_USART_PIN_CK;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(SC_USART_GPIO, &GPIO_InitStructure);
/* Configure USART Tx pin as alternate function open-drain */
GPIO_InitStructure.GPIO_Pin = SC_USART_PIN_TX;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_OD;
GPIO_Init(SC_USART_GPIO, &GPIO_InitStructure);
/* Configure Smartcard Reset pin */
GPIO_InitStructure.GPIO_Pin = SC_PIN_RESET;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(SC_PIN_RESET_GPIO, &GPIO_InitStructure);
USART_SetPrescaler(SC_USART, 0x05);
USART_SetGuardTime(SC_USART, 16);
USART_StructInit(&USART_InitStructure);
USART_InitStructure.USART_BaudRate = 9677;
USART_InitStructure.USART_WordLength = USART_WordLength_9b;
USART_InitStructure.USART_StopBits = USART_StopBits_1_5;
USART_InitStructure.USART_Parity = USART_Parity_Even;
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
USART_Init(SC_USART, &USART_InitStructure);
USART_ClockInitStructure.USART_Clock = USART_Clock_Enable;
USART_ClockInit(SC_USART,&USART_ClockInitStructure);
/* Enable the SC_USART Parity Error Interrupt */
USART_ITConfig(SC_USART, USART_IT_PE, ENABLE);
/* Enable the SC_USART Framing Error Interrupt */
USART_ITConfig(SC_USART, USART_IT_ERR, ENABLE);
/* Enable SC_USART */
USART_Cmd(SC_USART, ENABLE);
/* Enable the NACK Transmission */
USART_SmartCardNACKCmd(SC_USART, ENABLE);
/* Enable the Smartcard Interface */
USART_SmartCardCmd(SC_USART, ENABLE);
|
这个是管脚的初始化。请问一下还有没有什么我没有注意的?我也就只是初始化管脚,但是一直收不到数据,stm32f103zet6这上面就很正常。 |
|