Hello,
I am trying to use the SC16IS740 chip in order to read a periodically & single-character sending UART device via I2C from an embedded linux module. In a first step I would just like to read the characters manually using i2ctools, without interrupts or FIFO. However, I'm not sure if I do the configuration correctly.
UART specification: Baud 9600, 8bit word lengt, no parity, 1 stop bit
Crystal: 1.8432MHz
Configuration sequence:
i2cset -y 2 0x4d 0x18 0x80 # LCR - access special registers
i2cset -y 2 0x4d 0x00 0x0C # DLL - divisor 0x000C (12) to get baud 9600
i2cset -y 2 0x4d 0x08 0x00 # DLH - divisor 0x000C (12) to get baud 9600
i2cset -y 2 0x4d 0x18 0x03 # LCR - access general registers, set config 8N1
i2cset -y 2 0x4d 0x10 0x00 # FCR - disable FIFO (default..)
i2cset -y 2 0x4d 0x08 0x00 # IER - disable interrupts(default..)
(note: register addresses are shifted by one compared to the datasheet)
By now I think I should be able to read the character sent by my UART device in the RHR register and see the LSR[0] flag set. However, RHR is constantly at 0x04 and the LSR[0] flag cleared.
Am I missing something in my configuration sequence so far or am I probably facing a hardware issue?
Thanks for every advice
Oliver
Hello Oliver,
I hope all is great with you.
In this case, I would like to recommend the example project below. At the example mentioned, you may find an initialization of the device that can be useful for you.
SC16IS752 - Bare metal example project
I hope the information provided was useful for you. Please let me know if you have any further question.
Regards,
David
Hello David
Thanks for your input. I've seen similar initializations in some application notes before and as you can see adapted my approach to it. However since I don't want to use interrupts of FIFO yet, I don't think I need enhanced functions etc.
Regards,
Oliver
Hi Oliver,
If you are not using interrupts how do you know when there is data available? Are you constantly polling the LSR[0]? The configuration you used is correct, maybe you could share with us a fragment of the code to try to find why you can't read from RHR register.
Darío
Hello Dario,
Thanks for the confirmation. For the moment I work just with manual commands, no code.
The UART device on the other side sends periodically (~50Hz) one character (from a set of 8 possible characters). I figured, I should be able to read this with a randomly timed, manual register read, but I see your point with the interrupts.
How is the chip supposed to work in this case?
Regards,
Oliver