Good that they are updating the docs.
However I'm still unconvinced there is not a subtle unfound problem hiding away too bite us later in the LPUARTs.
Here is the code I use to shut down LPUART0. Note the 'while( 0UL != LPUART0_CTRL )'.
When I remove that my sound system using a complex mess of DMA and timers to generate sound stops working; Never let a Government Paper Pusher write technical requirements. LPUART0 is not involved in timers nor DMA.
What is the connection?
void uart0_shutdown( void )
{
if( 0U != ( SIM_SCGC5 & SIM_SCGC5_LPUART0_MASK ) ) /* Shutting uart off more than once will cause bus fault */
{
while( 0U == ( LPUART0_STAT & LPUART_STAT_TC_MASK ) ) /* Wait until transmit shift register is empty */
{
nop();
}
LPUART0_CTRL = 0UL; /* Can only update baud when disabled */
LPUART0_BAUD = (
LPUART_BAUD_OSR( 0xFU ) | /* Reset to default value data sheet values */
LPUART_BAUD_SBR( 4U )
);
while( 0UL != LPUART0_CTRL )
{
nop(); /* Read to synchronize time domains? Sound does not work if don't do this. What is the connection to sound? */
}
NVIC_DisableIRQ( INT_LPUART0 );
SIM_SCGC5 &= ~SIM_SCGC5_LPUART0_MASK;
}
PORTA_PCR1 &= ~( PORT_PCR_PFE_MASK | PORT_PCR_PE_MASK | PORT_PCR_PS_MASK ); /* Clear out old setting */
PORTA_PCR1 |= ( PORT_PCR_PFE_MASK | PORT_PCR_PE_MASK ); /* PullDown */
}