UART doesn't receive data

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

UART doesn't receive data

Jump to solution
2,228 Views
albertolubeiro
Contributor III

Hi,

I am with a kinetis K64 with KDS 3.0 and KDSK1.2.0 and also with MQX.

My issue is that i do send data from UART to a PC terminal but i do not receive data from the PC terminal.

I am using the functions of "fsl_uart_hal.c"

This is my code after have initilized the UART

// Inform to start polling example

        byteCountBuff = sizeof(buffStart);

        UART_HAL_SendDataPolling(baseAddr, buffStart, byteCountBuff);

        // Inform user of what to do

        byteCountBuff = sizeof(bufferData1);

        UART_HAL_SendDataPolling(baseAddr, bufferData1, byteCountBuff);

    while (1){

        if (kStatus_UART_Success == UART_HAL_ReceiveDataPolling(baseAddr, rxChar, sizeof(rxChar)))

            {

                // Send any character that received

                UART_HAL_SendDataPolling(baseAddr, rxChar, sizeof(rxChar));

            }

    }

In the freedom, this code works fine in the example "uart_polling"

I understand that i have nothing to do with the interrupt since this is a waiting loop, isn't it?

the diference is that my project is based in MQX and the some files that i have had to change which are:

     -     pin_mux.c

     -     pin_mux.h

     -     gpio_pins.c

     -     gpio_pins.h

     -     board.c 

     -     board.h   

Any help will be apreciated.

Thanks and best regards

0 Kudos
1 Solution
633 Views
albertolubeiro
Contributor III

Hi,

i have solved the issue. At least i recive some data but still getting some issues trying to recive all data.

View solution in original post

0 Kudos
4 Replies
634 Views
albertolubeiro
Contributor III

Hi,

i have solved the issue. At least i recive some data but still getting some issues trying to recive all data.

0 Kudos
633 Views
santiago_gonzal
NXP Employee
NXP Employee

Hello Alberto,

If you are using MQX, is the UART Polling the only task that MQX is managing? If not, what is the priority and the frequency of triggering of that task? And what is the baudrate?

Regards,

Santiago

0 Kudos
633 Views
albertolubeiro
Contributor III

Hi Santiago,

Yes, it is the only active task.

The priority is 10, it has an OSA_TimeDelay(100) and as for the baudrate i have checked it out with 115200 and 9600, with same result.

I try to send the word "alberto" and the buffer called "rxChar" may set to alberto, aertoal, lbertol etc...

and when this data must be send, all data are sent but 2. for example alber, aerto, lbert etc..

The code is below:

while (1){

        GPIO_DRV_ClearPinOutput(PTC18); //CTS

        GPIO_DRV_ClearPinOutput(PTC19); //RTS

        OSA_TimeDelay(100);

        memset(rxChar, 0, sizeof(rxChar));

        if (kStatus_UART_Success == UART_HAL_ReceiveDataPolling(baseAddr, rxChar, sizeof(rxChar)))

            {

                // Send any character that received

                GPIO_DRV_SetPinOutput(PTC18); //CTS     break point here so i can remove the RTS option in the PC terminal before send the data

                GPIO_DRV_SetPinOutput(PTC19); //RTS

                OSA_TimeDelay(100);

                UART_HAL_SendDataPolling(baseAddr, rxChar, sizeof(rxChar));

            }

    }

Thanks Santiago, and best regards.

0 Kudos
633 Views
santiago_gonzal
NXP Employee
NXP Employee

Hello Alberto,

Can you share the whole project? I want to see also the configuration parameters of the UART.

Regards,

Santiago

0 Kudos