industrialNETworXnetx

Rainer Versteeg

Rainer Versteeg

| 08.08.2008 | 15:42 | 1 reply

HAL_NETX100_500_CX_UART

HI.

I have downloaded the HAL_Netx100_500_XC_UART example.

The example runs and work O.K.

I have connect on the Interbus (RS422) output of the NXDB500-SYS a PC wich gets the sended character over UART0.

But when i set a breakpoint in one line in the code and want to step over the function, only one Character is received at the Port of the XC_UART 2.

When i dont set a breakpoint all character are received at XC_UART2.

/* check for data rx at XC_UART */
if (XC_UART_OKAY != XC_Uart_GetIndicationFifoFillLevel(xcportnr, &ulFillLevel))
{
/* ERROR: something failed */
setRdyRunLed(RDYRUN_LED_RED);
while(1) {}
}

if (ulFillLevel != 0)
{
/* data at XC_UART available transfer it to UART0 */
if (XC_UART_OKAY != XC_Uart_GetDataChar(xcportnr, &ulData))
{
/* ERROR: something failed */
setRdyRunLed(RDYRUN_LED_RED);
while(1) {}
}
NetXPutCharacter(0,ulData);
}

Why the character are lost ?

Br
Rainer

M T

M T

Hilscher Gesellschaft für Systemautomation mbH

| 11.08.2008 | 07:22

Hi Rainer,

Did you initialized the FIFO unit wrong? If there's not enough space in the FIFO unit the UART needs to discard the data as every normal UART does. There is a diagnostics counter for this case (see ulIndDroppedDueFifoFullCnt / ulIndCharDroppedDueFifoFullCnt / ulIndDroppedDueNoEmptyPointerCnt).

The following code comes from the XC Uart Example and is made for UART0:

const unsigned int auPfifoBorders[32] = { 100, 100, 100, 100, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
                                          1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };

The sum of all elements must not exceed 2048 on netX100/500 (and 1024 on the netX50).

Please try the following which should work for all 4 Ports.

const unsigned int auPfifoBorders[32] = { 100, 100, 100, 100, 28, 28, 28, 28, 
                                          100, 100, 100, 100, 28, 28, 28, 28, 
                                          100, 100, 100, 100, 28, 28, 28, 28, 
                                          100, 100, 100, 100, 28, 28, 28, 28 };

ATTENTION: This will reset and re-initalize all FIFO units. These depths are only meant to be used with the UART.

Regards

MT

Login