AnsweredAssumed Answered

UART - mqx write not accessing the UART registers

Question asked by Robert Lewis on Jan 10, 2013
Latest reply on Jan 21, 2013 by Robert Lewis

Hi

 

I have a logic analyzer on TX0 capturing the output of uart0, but I under mqx 3.8.1 I don't see any output.

 

I get a 0 for the return status on all the mqx calls which I think is a success. The file open works, the baud rate is set and read back ok, same with the status on the write. But nothing is coming out the Tx line. When I step into the mqx _io_write, all I can see happening is the length of the buffer is being calculated, it never access's any uart registers, it is almost as if the mqx uart code is not being compiled but I can't see where any conditional exclusion occurs, yet the RTOS returns a 0 on the write call.

 

Any help would be appreciated.

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I have this in the user_config.h, I am assuming that ttya: is channel 0 of the uart., the bsp and psp were recompiled without error.

 

#define BSP_DEFAULT_IO_CHANNEL              "ttya:"

#define BSP_DEFAULT_IO_CHANNEL_DEFINED

 

/* MGCT: <generated_code> */

#define BSPCFG_ENABLE_TTYA       1

 

 

void rs232_write (void)

{

static MQX_FILE_PTR        p_fd_rs232 = NULL;

static char                ac_data_buffer[10] = "AT\n", *pac_data_buffer;           // "AT&F*";

static sint32              s32_result;

static uint32              u32_result;

static uint32              u32_param, u32_char_rcvd = 0;

static bool                temp;

    pac_data_buffer = ac_data_buffer;

    fflush(stdout);

    p_fd_rs232  = fopen( SERIAL__CHANNEL, NULL );        // HW, will not use flow cntrl

// **rwl        p_fd_rs232  = fopen( SERIAL__CHANNEL, BSP_DEFAULT_IO_OPEN_MODE );        // HW, will not use flow cntrl

    if( p_fd_rs232 == NULL ){

        vFn_Printff();        //"error");

    }

    fflush(stdout);

 

    u32_param = 9600;

    s32_result = ioctl( p_fd_rs232, IO_IOCTL_SERIAL_SET_BAUD, &u32_param );// set, wait for transfer complete flag

    s32_result = ioctl( p_fd_rs232, IO_IOCTL_SERIAL_GET_BAUD, &u32_param );

    fflush(stdout);

    while(1){

// **rwl            s32_result = write( p_fd_rs232, ac_data_buffer, (long)strlen(ac_data_buffer) );           // write data

        s32_result = _io_write( p_fd_rs232, ac_data_buffer, (long)strlen(ac_data_buffer) );           // write data

        _time_delay(1);

    }

 

 

 

 

 

Outcomes