-
GD32F303芯片 SMARTCARD 7816智能卡功能初始化问题
本帖最后由lonkyzhang于2022-4-2018:09编辑在官方库中没有smartcard的例程,我照着ST的方法写了一下初始化,使能了时钟,PB14的RST复位信号用示波器可以看到,但PB12的CLK对应管脚一直没有时钟信号,一直是低电平。使用的GD32F303RCT6代码如下,请教各位大神!感谢!unsignedcharInit_Card_Slot(unsignedcharInit_Psam_Slot(unsignedchar*Atr){rcu_periph_clock_enable(RCU_GPIOB);rcu_periph_clock_enable(RCU_USART2);gpio_init(GPIOB,GPIO_MODE_OUT_PP,GPIO_OSPEED_50MHZ,GPIO_PIN_13);//VCCPB13gpio_init(GPIOB,GPIO_MODE_OUT_PP,GPIO_OSPEED_50MHZ,GPIO_PIN_14);//RSTPB14gpio_init(GPIOB,GPIO_MODE_AF_OD,GPIO_OSPEED_50MHZ,GPIO_PIN_10);//IOPB10USART2TXgpio_init(GPIOB,GPIO_MODE_AF_PP,GPIO_OSPEED_50MHZ,GPIO_PIN_12);//CLKPB12USART2CKgpio_bit_set(GPIOB,GPIO_PIN_13);//VCC=1//关闭失能usart_deinit(USART2);usart_disable(USART2);usart_synchronous_clock_disable(USART2);usart_transmit_config(USART2,USART_TRANSMIT_DISABLE);usart_receive_config(USART2,USART_RECEIVE_DISABLE);usart_hardware_flow_rts_config(USART2,USART_RTS_DISABLE);usart_hardware_flow_cts_config(USART2,USART_CTS_DISABLE);//配置传输格式usart_word_length_set(USART2,USART_WL_9BIT);usart_stop_bit_set(USART2,USART_STB_1_5BIT);usart_parity_config(USART2,USART_PM_EVEN);usart_transmit_config(USART2,USART_TRANSMIT_ENABLE);usart_receive_config(USART2,USART_RECEIVE_ENABLE);usart_synchronous_clock_config(USART2,USART_CLEN_NONE,USART_CPH_1CK,USART_CPL_LOW);usart_baudrate_set(USART2,9600);usart_guard_time_config(USART2,0x00);//其他模式失能usart_lin_mode_disable(USART2);usart_halfduplex_disable(USART2);usart_irda_mode_disable(USART2);//开启USART2usart_enable(USART2);gpio_bit_res
2022-04-20 3