mos_uclose calls close_UART1 in mos.c, which doesn't appear to remove the previously registered interrupt(s) from the UART1_IER register. This causes an issue later on, when the old interrupt vector is put back in place.
When I use the MOS API mos_setintvector to set my uart1 handler, then mos_uopen using a uart structure, call my own closing routine and put back the previous vector with mos_setintvector, everything runs just fine.
I'm using this close to close out the UART1 before returning the old vector:
VOID close_UART1( VOID )
{
UART1_IER = 0 ; //! Disable all UART1 interrupts.
UART1_LCTL = 0 ; //! Bring line control register to reset value.
UART1_MCTL = 0x00 ; //! Bring modem control register to reset value.
UART1_FCTL = 0 ; //! Bring FIFO control register to reset value.
init_UART1(); // set port pins to original values
return ;
}
perhaps it's unnecessary to again init the UART1, but I was just being cautious.
mos_uclose calls close_UART1 in mos.c, which doesn't appear to remove the previously registered interrupt(s) from the UART1_IER register. This causes an issue later on, when the old interrupt vector is put back in place.
When I use the MOS API mos_setintvector to set my uart1 handler, then mos_uopen using a uart structure, call my own closing routine and put back the previous vector with mos_setintvector, everything runs just fine.
I'm using this close to close out the UART1 before returning the old vector:
VOID close_UART1( VOID )
{
UART1_IER = 0 ; //! Disable all UART1 interrupts.
UART1_LCTL = 0 ; //! Bring line control register to reset value.
UART1_MCTL = 0x00 ; //! Bring modem control register to reset value.
UART1_FCTL = 0 ; //! Bring FIFO control register to reset value.
}
perhaps it's unnecessary to again init the UART1, but I was just being cautious.