移植到F4的板子上,时钟就是不启动,折腾了两天,找了问题,
#define DS1302_CE GPIO_Pin_10
#define DS1302_IO GPIO_Pin_11
#define DS1302_SCLK GPIO_Pin_12
#define DS1302_CE_H DS1302_PORT->BSRRL = DS1302_CE
#define DS1302_CE_L DS1302_PORT->BSRRH = DS1302_CE
#define DS1302_IO_H DS1302_PORT->BSRRL = DS1302_IO
#define DS1302_IO_L DS1302_PORT->BSRRH = DS1302_IO
//#define DS1302_IO_R (DS1302_PORT->IDR &DS1302_IO) //F1能用,F4不能,不知道何因。
#define DS1302_IO_R GPIO_ReadInputDataBit(GPIOE,GPIO_Pin_11) //F4上面能用
就是这两句,时序从头检查到尾,加长了延时,最后改了这句才行,时钟终于启动了。
|