在线时间16 小时
UID153568
注册时间2009-10-9
NXP金币0
TA的每日心情 | 衰 2016-11-8 14:02 |
---|
签到天数: 1 天 连续签到: 1 天 [LV.1]初来乍到
注册会员

- 积分
- 172
- 最后登录
- 1970-1-1
|
MKL16Z128处理器,UART0和UART1/2的配置寄存器有差异
/** UART0 - Register Layout Typedef */
typedef struct {
__IO uint8_t BDH; /**< UART Baud Rate Register High, offset: 0x0 */
__IO uint8_t BDL; /**< UART Baud Rate Register Low, offset: 0x1 */
__IO uint8_t C1; /**< UART Control Register 1, offset: 0x2 */
__IO uint8_t C2; /**< UART Control Register 2, offset: 0x3 */
__IO uint8_t S1; /**< UART Status Register 1, offset: 0x4 */
__IO uint8_t S2; /**< UART Status Register 2, offset: 0x5 */
__IO uint8_t C3; /**< UART Control Register 3, offset: 0x6 */
__IO uint8_t D; /**< UART Data Register, offset: 0x7 */
__IO uint8_t MA1; /**< UART Match Address Registers 1, offset: 0x8 */
__IO uint8_t MA2; /**< UART Match Address Registers 2, offset: 0x9 */
__IO uint8_t C4; /**< UART Control Register 4, offset: 0xA */
__IO uint8_t C5; /**< UART Control Register 5, offset: 0xB */
} UART0_Type;
/** UART1/2 - Register Layout Typedef */
typedef struct {
__IO uint8_t BDH; /**< UART Baud Rate Register: High, offset: 0x0 */
__IO uint8_t BDL; /**< UART Baud Rate Register: Low, offset: 0x1 */
__IO uint8_t C1; /**< UART Control Register 1, offset: 0x2 */
__IO uint8_t C2; /**< UART Control Register 2, offset: 0x3 */
__I uint8_t S1; /**< UART Status Register 1, offset: 0x4 */
__IO uint8_t S2; /**< UART Status Register 2, offset: 0x5 */
__IO uint8_t C3; /**< UART Control Register 3, offset: 0x6 */
__IO uint8_t D; /**< UART Data Register, offset: 0x7 */
__IO uint8_t C4; /**< UART Control Register 4, offset: 0x8 */
} UART_Type;
SDK的驱动都使用UART_Type,例程Uart1,而实际使用Uart0时,若调用标准驱动,导致程序错误~
如何解决? 自己写驱动?
最佳答案
UART0的不要使用fsl_uart.h中的库,而要使用fsl_lpsci.h中的库,两者是不太一样的
|
|