PSoc5 UART_SetRxAddress1 does not work

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

I have the RX Address Configuration set to

   

Address#1 = 1

   

Address#2 = A

   

When I call the UART_SetTxsAddress1(2)  the address does not change as I can only communicate on addresses 1 and A.

   

Is there something else I must do when calling UART_SetTxsAddress1? ie stop and start the UART?

0 Likes
1 Solution
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

How is your UART configured?

   

- full vs., half duplex

   

- what address mode do you use?

   

- how do you read the data (ISR?)

   

Could it be that there is still data in the buffer which is send to the old address?

   

hli

View solution in original post

0 Likes
7 Replies
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

How is your UART configured?

   

- full vs., half duplex

   

- what address mode do you use?

   

- how do you read the data (ISR?)

   

Could it be that there is still data in the buffer which is send to the old address?

   

hli

0 Likes
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

Oh, and which method is it that you call? The topic says UART_SetRxAddress1, but the posting UART_SetTxAddress1...

0 Likes
Anonymous
Not applicable

 It would be easier if you upload your project here 🙂

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hi there,

   

Thank you for your reply.

   

The UART is configured as Full duplex.

   

Addressing mode is Byte by Byte.

   

I use and ISR to read the data (from the UART doc example)

   

I have attached the setup of the UART as a jpg.

   

In the code below I added the clear rx and tx buffers as well as the stop and start but this did not help.

   

 

   

Ryl

   

 

   

// DOES NOT WORK!!!
// The UART_485_SetRxAddress1() call does not change the hardware address
void RS485_SetSensorAddress(int address)
{
    char outputStr[80];
    sprintf(outputStr,"Setting 485 UART address 1 to %d",address);
    SendUARTMessage(outputStr,1);
   
    sprintf(outputStr,"Current address = %d",UART_485_RXADDRESS1_REG);
    SendUARTMessage(outputStr,1);
   
    SendUARTMessage("485 UART TX complete",1);
   
    UART_485_ClearRxBuffer();
    UART_485_ClearTxBuffer();
   
    CyDelay(5);

    UART_485_SetRxAddress1((uint8)address);
    UART_485_Stop();
    UART_485_Start();
   
    sprintf(outputStr,"Current address = %d",UART_485_RXADDRESS1_REG);
    SendUARTMessage(outputStr,1);
   
    SendUARTMessage("485 UART Address change complete",1);
   
}

0 Likes
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

The manual says to that (page 8):

   

Software Byte by Byte – Hardware indicates the detection of an address byte
(UART_RX_STS_MRKSPC status) for every byte received. Software must read the byte and
determine if this address matches the device addresses defined as in the Address #1 or
Address #2 parameters or any other additional addresses.
 

   

I would read this as 'the UART tells the ISR that an addrsss byte has received, but the ISR needs to handle the addressing by itself'. This means that setRxAddress would have no effect, since all addressing is done in software (the manual mentions this on the same page).

   

 

   

hli

Anonymous
Not applicable

Hi hli,

   

Thanks for your help. Yes, I need to use the hardware mode. Now I can change the address of the UART.

   

Ryl

0 Likes
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

Glad it worked.

0 Likes