AnsweredAssumed Answered

MKL26 UART0 设置问题

Question asked by bi shihao on Jul 24, 2015

大家好,我在用KINETIS-SDK包

                    和KL26芯片

                    开发UART0收送功能时,老报错,是不是SDK不支持KL26的UART0?

代码大致如下,还是我哪里设置的不对?

uint8_t buf[17] = {0xAA,0x55};
uart_user_config_t uartConfig;
uartConfig.baudRate = 9600;
uartConfig.bitCountPerChar = kUart8BitsPerChar;
uartConfig.parityMode = kUartParityDisabled;
uartConfig.stopBitCount = kUartOneStopBit;
uart_state_t uartState;

   

hardware_init();

   

SIM_SOPT2 |= SIM_SOPT2_PLLFLLSEL_MASK;
SIM_SOPT2 |= SIM_SOPT2_UART0SRC(1);
SIM_SCGC4 |= SIM_SCGC4_UART0_MASK;

   

PORTE_PCR20 |= PORT_PCR_MUX(0x4);                                                 
PORTE_PCR21 |= PORT_PCR_MUX(0x4);

   

UART_DRV_Init(0, &uartState, &uartConfig);
while(1)
{
    UART_DRV_SendData(1,buf,17);
    ;//断点
}

Outcomes