initializing and sending packets using SC16IS740

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

initializing and sending packets using SC16IS740

888 Views
ChameeraSubasinghe
Contributor II

One of our products that is in prototype stage uses SC16IS740 to send and receive data from RS485 bus. This SC16IS740 is connected to Raspberry PI 3 using SPI peripheral.

We have verified that the SPI communication works correctly by writing 0xAA to SPR register and reading that same SPR register back to see whether the 0xAA is in that register.

 

Following steps are taken to initialize the SC16IS740.

1)setting baud rate to 19200

setting LCR register to 0x80

setting DLL register to 0x06 and DLH register to 0x00 (the crystal we use is 1.83432MHz and the baud rate we are trying to use is 19200. therefore the divider is 0x0006)

 

2) 8 data bits, 0 parity, 1 stop bit selection

setting LCR register to 0xBF

setting EFR register to 0x10

setting LCR register to 0x03

 

3) clearing FIFO

setting FCR register to 0x06

 

4) enabling the FIFO

setting FCR register to 0x01

 

above steps are taken to initialize the SC16IS740 chip.

 

currently we are sending some data into the RS485 bus continously though a STM32. we checked with the other devices attached to the RS485 bus that the data STM32 puts in to the RS485 bus is indeed receiving to the devices.

 

But when we try to receive same data from the Raspberry pi side using the SC16IS740. we receive nothing.

when we read RXLVL register it says 0.

but if we read the RHR register we see 0x02 as data. (just 1 byte. but we are sending 30 bytes from the STM32 side)

 

we even try to use loopback mode to see whether we can see some data.

So the initialization steps are same as above. but we set the

MCR register to 1<<4 as well in the end.

 

then we write a byte to THR register, and try to read the RHR register. but it still says 0x02. no matter what byte we right to the THR register. the RHR register returns 0x02.

 

So seems like there is an initialization issue somewhere. Please explain what we are doing wrong. it's best if someone can provide a working example in python or in C/C++.(the initilization steps we are using right now was extracted from application notes on the SC16IS740 product page)

Tags (2)
0 Kudos
3 Replies

873 Views
guoweisun
NXP TechSupport
NXP TechSupport

Had replied to you for the code example/

0 Kudos

872 Views
ChameeraSubasinghe
Contributor II

Thanks for the linux drivers. i will go through it and test it on our co-processor (Raspberry Pi).

Just few quick questions.

1) The driver says it's for SC16IS750. but it will work for the SC16IS740 right? because the bridge that we use is a SC16IS740

2) Do you have a ARM (32bit MCU. CortexM ) driver for this same chip? because our next product will have cortex M based processor to interface with this UART bridge.

0 Kudos

866 Views
guoweisun
NXP TechSupport
NXP TechSupport
1: You can refer it 750 has GPIO pins which not in 740. 2: No others code for reference.
0 Kudos