AnsweredAssumed Answered

KL17 LPUART data register is not shifted out

Question asked by Don Weier on Jun 2, 2017

All,

 

I'm having what appears to be a very basic problem implementing an LPUART set of functions, but I've been stuck for most of a day now so I'm turning to the community.

 

The code is interrupt driven in order to handle the high output rate without blocking my other code. I've attached the .c and related header file, but a summary of the problem is below:

 

After Initialize is called, the registers are in the following state:

LPUART_BAUD: 0x19000008

LPUART_STAT: 0x00800000

LPUART_CTRL: 0x000C0000

LPUART_DATA: 0x00001000

LPUART_MATCH: 0x00000000

 

The init function is based on the example init function that comes with the KSDK for the KL27 freedom board.

 

   When I Tx, I set the TIE bit in CTRL so that the interrupt fires. When the ISR is called, it checks a pointer that is passed to the Tx function for the next byte, writes it to the DATA register, and returns, repeating until the full length of the buffer has been handled this way. When there are no bytes left in the buffer, the ISR clears the TIE bit until a new Tx is called for, when the entire process should repeat.

   I am able to confirm that the ISR is called once, and not again. I am also able to see that the TDRE bit is not ever set after the initial write to the DATA register. I'm using a18 for the Rx, and a19 for the Tx. Their port control registers after initialization have the mux values set to 3, and the PDDR register shows the appropriate direction for both pins. The TE and RE bits are set in CTRL. I'm not sure what I'm missing.

   If I put an oscilloscope on the Tx pin, I do not see any signal at all (not even the first byte I write to the DATA register). It looks to me like the shift register is not emptying the DATA register, but I can't find any errata or documentation that would suggest why this would be happening. 

 

Any help would be greatly appreciated!

 

Best,

 

Don

Original Attachment has been moved to: LPUART_HAL.c.zip

Original Attachment has been moved to: LPUART_HAL.h.zip

Outcomes