Help understanding the SC16IS740 datasheet. SPI to UART registers

The official pyboard running MicroPython.
This is the reference design and main target board for MicroPython.
You can buy one at the store.
Target audience: Users with a pyboard.
Post Reply
dweinho1
Posts: 8
Joined: Sun Mar 06, 2022 5:22 pm

Help understanding the SC16IS740 datasheet. SPI to UART registers

Post by dweinho1 » Wed Mar 30, 2022 11:26 am

Hi all, I am back with a simple question. I am using a pyboard to communicate with a six devices over UART. Of course it only has five UARTs available so I am using a breakout board with a SC16IS740 SPI to UART converter. https://www.digikey.com/en/products/det ... 49/9960305

I am not getting it to respond the way I expect it to and need help to confirm I am reading the datasheet correctly. Here is the datasheet: https://www.nxp.com/docs/en/data-sheet/ ... 50_760.pdf
The list of registers is on page 21.

I am trying to do the following:
- Write to the LCR register (0x03)--allow setting the special registers, set parity to none, stops bits to 1, and data bits to 8.
- Write the special registers (0x00 and 0x01)--set a divisor of 12 for 9600 baud rate
- Write to the LCR register again
- Read the RCR register (0x00)

So I am sending the following (binary and hex):
- LCR register write: 0001 1000 1000 0011: 0x18 0x83
- DLL register write: 0000 0000 0000 1100: 0x00 0x0C
- DLH register write: 0000 1000 0000 0000: 0x08 0x00
- LCR register write: 0001 1000 0000 0011: 0x18 0x03
- RCR register read: 1000 0000: 0x80

I also believe the polarity and phase are both 0 based on page 43.

Does this look correct?

dweinho1
Posts: 8
Joined: Sun Mar 06, 2022 5:22 pm

Re: Help understanding the SC16IS740 datasheet. SPI to UART registers

Post by dweinho1 » Sat Apr 02, 2022 7:25 pm

As a little update in case anyone searches for the SC16IS740 in the future.

I am getting reading and writing registers at this point but it is intermittent. Seems like I am going to have to break down and get a logic analyzer.

Meanwhile I am doing the following (basically what I wrote above):

Code: Select all

LCR_register_read = '10011000' 
LCR_register_write = '00011000'
LCR_init = '10000011' # unlocks the "special registers"--DLL and DLH--that allows setting the baudrate
LCR_deinit = '00000011' #locks the special registers; also setting parity to none, stop bit to 1, and data bits to 8

DLL_write = '00000000'
DLL_value = '00001100' #sets baud rate to 9600 based on 1.8432 MHz crystal
I am then also writing to the transmit register and monitoring the serial port with tera term and USB to serial converter. I am not seeing anything. This is the converter (though not that it matters) https://www.usbgear.com/USBG-232MINI.html
I need to try swapping the lines but right now I don't have anything to do that.

Post Reply