parity/stopbits issue on 16550 in vxWorks

Started by bo April 12, 2010
I'm having great difficulty getting a 16550 UART to transmit parity/2 stop bits. I'm
using vxWorks6.4, Workbench2.6 tools for an MVME5100 (74xx processor board). I get
no errors returned on the ioctl() calls and the options read back equal the options
set--but the UART is not
transmitting parity bit and not transmitting the 2nd stop bit (in other words, the
only change from the default values that works is the change of baudrate to
115.2Kbps.

Any suggestions/comments greatly appreciated. I have opened a TSR with WindRiver on
this, but am hoping someone here has encountered this before and know what the
problem is.

Thanks, Bo

Here's my initialization code:


void init_uart2(void)
{
int ioctl_return;
int val = 0;
int error_code;
int options = (CS8    |  // 8bit data
               PARENB |  // parity enabled
               PARODD |  // odd parity
               STOPB  |  // 2 stop bits
               CREAD  |  
               CLOCAL);  
//unsigned char* uart2_lcr     = (unsigned char*) 0xFEF88203;  // direct access of
LCR via this code
//unsigned char* uart2_scratch = (unsigned char*) 0xFEF88207;  // doesn't work
either
//volatile unsigned char udata = 0x0;

    sio_fd = open("/tyCo/1", O_WRONLY, 0644); // Open serial device
    if(sio_fd == ERROR)
    {
        error_code = errno;
        printf("open of serial port returned error\n");
        printf("errrno = 0x%08x\n", error_code);
    }
    
    ioctl_return = ioctl(sio_fd, FIOBAUDRATE, (int)BAUD_RATE); // Set baud rate
    if(ioctl_return == ERROR)
    {
        error_code = errno;
        printf("ioctl(baud rate) returned error\n");
        printf("errrno = 0x%08x\n", error_code);
    }

    ioctl_return = ioctl(sio_fd, FIOSETOPTIONS, OPT_RAW); // Set baud rate
    if(ioctl_return == ERROR)
    {
        error_code = errno;
        printf("ioctl(OPT_RAW) returned error\n");
        printf("errrno = 0x%08x\n", error_code);
    }

    ioctl_return  = ioctl(sio_fd, FIOSETOPTIONS, options);
    if(ioctl_return == ERROR)
    {
        error_code = errno;
        printf("ioctl(options) returned error\n");
        printf("errrno = 0x%08x\n", error_code);
    }
//  ioctl_return = ioctl(sio_fd, SIO_HW_OPTS_GET, val); runs but gives mismatch on
write then read option values
    ioctl_return = ioctl(sio_fd, FIOGETOPTIONS, val);
    if(ioctl_return != options)
    {
	  printf("ioctl(options) don't match desired settings\n");
 	  printf("Desired options = 0x%08X Options read = 0x%08X\n", options,
ioctl_return);
    }
	
//	*uart2_scratch = (unsigned char) 0xc9;  // when this commented out code is run,
the read values never 
//	udata         = *uart2_scratch;         // equal the written values
//	
//	*uart2_lcr    = (unsigned char) 0x0F;
//	udata         = *uart2_lcr;

}//end init_uart2()


--------------=  Posted using GrabIt  =----------------
------=  Binary Usenet downloading made easy =---------
-=  Get GrabIt for free from http://www.shemes.com/  =-