I'm trying to implement 9-bit multidrop mode UART under MQX. I'm wondering what the best way to do this would be.
Can/should I modify the MCF_UARTx_UMR1, MCF_UARTx_UCR registers directly as needed ? Or should I be trying to adjust the UART init_struct (MCF52XX_UART_SERIAL_INIT_STRUCT)? Or is there some other better way? Is MQX able to handle the multidrop bit for me?
Thanks for your input,
Angelo
I'm able to achieve the result I'm looking for by directly accessing the MCF_... registers, and the required code is minimal so I'm satisfied with this solution, but I guess I'm just concerned that doing it like this will confilct in some way with MQX.
I created my own serl_pol_mcf52xx.c found in C:\Program Files\Freescale\Freescale MQX 3.6\mqx\source\io\serial\polled
I added this statement into _mcf52xx_uart_serial_polled_ioctl
switch (cmd) {
case IO_IOCTL_SERIAL_SET_PARITY:
tmp = io_info_ptr->INIT.UMR1_VALUE & ~MCF52XX_UART_UMR1_MASK_PARITY;
switch(*param_ptr)
{
case IO_SERIAL_PARITY_ODD:
tmp |= MCF52XX_UART_UMR1_ODD_PARITY;
break;
case IO_SERIAL_PARITY_EVEN:
tmp |= MCF52XX_UART_UMR1_EVEN_PARITY;
break;
case IO_SERIAL_PARITY_MULTI_DROP:
tmp |= MCF52XX_UART_UMR1_MULTI_DROP;
break;
case IO_SERIAL_PARITY_MD_ADDRESS:
tmp |= MCF52XX_UART_UMR1_MD_ADDRESS;
break;
case IO_SERIAL_PARITY_SPACE:
tmp |= MCF52XX_UART_UMR1_LOW_PARITY;
break;
case IO_SERIAL_PARITY_MARK:
tmp |= MCF52XX_UART_UMR1_HI_PARITY;
break;
case IO_SERIAL_PARITY_NONE:
default:
tmp |= MCF52XX_UART_UMR1_NO_PARITY;
break;
}
I added to serial.h
#define IO_SERIAL_PARITY_MD_ADDRESS (7)
#define IO_SERIAL_PARITY_MULTI_DROP (8)
I don'r know why MQX hasn;'t been changed yet to do this?