I have a FRDM-KL27Z dev board communicating with my Mac OSX via the OpenSDA USB port.
It appears that if I write a char to the LPUART with the MSB turned on (i.e. 0x80 - 0xff), the serial line goes idle for one byte period instead of transmitting the character, so if I send the pattern:
putchar(0x55);
putchar(0xa5);
putchar(0x5a);
... on the 'scope (J1-04, aka TX), I see 0x55 followed 10 bit periods of 'mark' followed by 0x5a .
Any idea what's going on?
Some details:
I'm enabling LPUART0 like this:
lpuart_config_t config;
LPUART_GetDefaultConfig(&config);
config.baudRate_Bps = 9600;
config.enableTx = true;
config.enableRx = true;
CLOCK_SetLpuart0Clock(0x03);
uint32_t uartClkSrcFreq = CLOCK_GetFreq(kCLOCK_McgInternalRefClk);
LPUART_Init(LPUART0, &config, uartClkSrcFreq);
And my putchar() routine looks like this:
void putchar(char ch) {
while (!(LPUART0->STAT & LPUART_STAT_TDRE_MASK)) {
// busy wait until TX buffer ready
}
LPUART0->DATA = ch;
}