-
AT32f423电池供电数据寄存器ERTC_BPRx半字操作不成功
本帖最后由gaolf_2000于2023-11-211:29编辑参照库里面的voidertc_bpr_data_write(ertc_dt_typedt,uint32_tdata){__IOuint32_treg=0;reg=ERTC_BASE+0x50+(dt*4);*(__IOuint32_t*)reg=data;}uint32_tertc_bpr_data_read(ertc_dt_typedt){__IOuint32_treg=0;reg=ERTC_BASE+0x50+(dt*4);return(*(__IOuint32_t*)reg);}写的:voidertc_bpr_16bitdata_write(uint16_tdt,uint16_tdata){__IOuint16_treg=0;reg=ERTC_BASE+0x50+(dt*2);*(__IOuint16_t*)reg=data;}uint16_tertc_bpr_16bitdata_read(uint16_tdt){__IOuint16_treg=0;reg=ERTC_BASE+0x50+(dt*2);return(*(__IOuint16_t*)reg);}时钟使能了,访问也使能了,但还是写不进去,读出来都是0xffff,不明白原因crm_periph_clock_enable(CRM_PWC_PERIPH_CLOCK,TRUE);pwc_battery_powered_domain_access(TRUE);
2023-11-02 16 -
AT32f323电池供电数据寄存器ERTC_BPRx半字操作不成功
参照库里面的voidertc_bpr_data_write(ertc_dt_typedt,uint32_tdata){__IOuint32_treg=0;reg=ERTC_BASE+0x50+(dt*4);*(__IOuint32_t*)reg=data;}uint32_tertc_bpr_data_read(ertc_dt_typedt){__IOuint32_treg=0;reg=ERTC_BASE+0x50+(dt*4);return(*(__IOuint32_t*)reg);}写的:voidertc_bpr_16bitdata_write(uint16_tdt,uint16_tdata){__IOuint16_treg=0;reg=ERTC_BASE+0x50+(dt*2);*(__IOuint16_t*)reg=data;}uint16_tertc_bpr_16bitdata_read(uint16_tdt){__IOuint16_treg=0;reg=ERTC_BASE+0x50+(dt*2);return(*(__IOuint16_t*)reg);}时钟使能了,访问也使能了,但还是写不进去,读出来都是0xffff,不明白原因crm_periph_clock_enable(CRM_PWC_PERIPH_CLOCK,TRUE);pwc_battery_powered_domain_access(TRUE);
2023-11-02 0