LPC1769 as RS485 slave device

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

LPC1769 as RS485 slave device

1,444 Views
kalpeshbalar
Contributor II

Hi, I am trying to use LPC1769 as RS485 slave device. And LPC11C14 used as master device.

Attached are master and slave program files.

 

If I enabble RECEIVER_ALWAYS_EN = 1 in slave then I am able to recive data on slave from the master.

But when I enable AUTO_SLVADDR_DETECT=1 in slave, I am not geting any data from master to slave.

What clould be wrong in attached master slave programs?

 

Thanks,

KBalar

Original Attachment has been moved to: master.c.zip

Original Attachment has been moved to: slave.c.zip

Labels (3)
0 Kudos
Reply
2 Replies

951 Views
kalpeshbalar
Contributor II

Hi Carlos,

The master is already setting parity to 1 while sending the address. Please refer below code to send address from master. (Please refer attached code in main post.)

uint8_t tmp, save;

save = tmp = LPC_USART->LCR & UART_LCR_BITMASK;
tmp &= ~(UART_LCR_PARITY_EVEN);
LPC_USART->LCR = tmp;

if (addr_toggle){
Chip_UART_SendBlocking(LPC_USART, (void*)SLAVE_ADDR_A, 1);
} else {
Chip_UART_SendBlocking(LPC_USART, (void*)SLAVE_ADDR_B, 1);
}

while (!(LPC_USART->LSR & UART_LSR_TEMT));
LPC_USART->LCR = save;

What could be the problem?

Thanks,

KBalar

0 Kudos
Reply

951 Views
Carlos_Mendoza
NXP Employee
NXP Employee

Hi KBalar,

When in Auto Address Detection (AAD) mode the receiver will compare any address byte received (parity = ‘1’) to the 8-bit value programmed into the RS485ADRMATCH register so please make sure the UART master transmitter is correctly identifying the address character by setting the parity (9th) bit to ‘1’ and that the parity bit is set to ‘0’ for data characters.


Hope it helps!

Best Regards,
Carlos Mendoza
Technical Support Engineer

0 Kudos
Reply