TI SN74LV8153 Serial to Parallel

Does anyone have any experience with the TI Serial to Parallel chip? Either with Imp or with Arduino? I can find data sheets, but no actual examples of how to send data from the Imp to the chip via UART. Basically I have to send a long string of bits. Not sure how to have the imp send out 18 bits in a row.

TI make a lot of these chips. Part number?


PDF Datasheet:

The hardware part is straight-forward. It’s the bit-stream required for start, address, output, stop … and the requirement for multiple bytes that has me stumped.

UART? 8 bits with 1 stop bit, no parity … or ? I have to send it like 18 bits to command the 8 digital outputs. I thought for sure someone might have already used this with an arduino. Seeing that would tip me off on how to send the bits serially, configure, protocol, etc. Not much info that I could find.

I’m only in need of serial out. That’s why I chose this particular chip. I want to send the serial bytes or bits to command any of the 8 digital outputs. Because this TI chip is addressable, I can actually add another one to create 16 digital outputs, etc. Doing this using only 2 pins on my April board would really open-up some ideas for me. (1 pin actually, since I’m only sending serial … nothing coming back).

Oh interesting, I’ve never seen anything which self-clocks like that. As it says, you need to keep the data rate under 24kbit (so 19,200 should be fine), and you need to use their format, which always has the top bit set - presumably to help with timing detection.

8 bit, no parity, 1 stop should be fine. As far as the imp is concerned, you just send two bytes:

local outputs = 0x2a; // for example local address = 0; // assuming all address input tied low uart.write(0x80 | (address <<4) | (outputs & 0x0f)); // send low nibble uart.write(0x80 | (address <<4) | (outputs >> 4)); // send high nibble

It’s not totally clear how it stays in sync if there’s corruption (there’s no difference in the address bits for the first and second bytes) but it would appear you might be able to just write to an unused address to regain sync.

Each byte write will output 10 bits (start, 8 data, 1 stop).

No luck with that …

But what is the difference between: uart.write

and: hardware.uart12.write

I’ve been using: hardware.uart12.write
Pin 1 is TX and goes to pin 5 of the chip.

The chip inputs (VCC1) are tied to 3.3V as the reference.
The chip outputs (VCC2) are tied to 5VDC regulated, and I’m using open collector mode.
The chip address lines are “address 0”, all tied to gnd.

For UART speed, I chose 9600 baud to make sure it’s slow enough for testing.

I’m not sure if imp pin 1 (TX) needs to be “tied high” with a resistor, or is it internally handled. Hardware-wise, I feel as though I’ve connected everything correctly.

I have a thought that the problem might be in having two UART “writes” as you have shown with low nibble and high nibble. Each one has the stop bit as indicated in the configuration, but what happens between the two “uart.write” statements? Is there anything with timing that may be an issue, or do you think the chip doesn’t care about the time between the bytes, as long as there is that “key” start bit?

my configure:
hardware.uart12.configure(9600, 8, PARITY_NONE, 1, NO_CTSRTS);

I just said uart.write as a generic thing, as I didn’t know what uart you were using.

Maybe try writing them both in the same write statement? ie:

uart.write(format("%c%c", 0x80 | (address <<4) | (outputs & 0x0f), 0x80 | (address <<4) | (outputs >> 4)));

You don’t need a pull up, UARTs idle high.

Looking at the datasheet; you need /OE tied low - you didn’t mention that you did this?

OE is tied low, that makes the outputs ‘open collector’.
No luck yet with the latest attempt (writing with one statement).
Is the syntax “%c%c” correct? Or did the editor on this forum change something there?

Thanks, buy the way, for taking extra time with this. It’s not really an imp issue, but more of my stubbornness to make this TI chip work. It seemed so easy when I looked at the spec sheet.

OE enables the outputs. If that’s high, then nothing will work (look at the truth table; any time OE is high then the output is either “Z” in push-pull mode (ie, floating) or “H” in open collector mode (which is also floating).

The syntax is correct for the format. What it’s doing is making a 2 byte string from the bytes following the format string.

Think I’ve worked the problem out. I forgot that UARTs send LSB first… try this:

uart.write(format("%c%c", 0x01 | (address<<1) | (outputs & 0x0f)<<4 , 0x01 | (address <<1) | (outputs&0xf0) );

I just realize that my pin 1 on the Imp no longer works. This is now the 2nd Imp I’ve had with a pin 1 that quit working. I know it’s not the April board. I’m sort of done with it now. I can’t afford to buy another one at this time. But thanks Hugo for taking time with this. Maybe in a few months I’ll have enough ambition to buy another one.

For a fix now, try a bit of paper between the top of the imp and the socket, for a longer term fix email info@electricimp.com and we’ll get you a new imp with no pin1 issue (and get the old one back).

I have success with a new Imp! Thanks Hugo!

Now I have another question …

My PHP script sends values to the agent, such as “0xff”, “0xa5”, etc.

These are coming across as strings. Now, with the Imp side, how do I use these as actual Hex values? I get a bitwise error now ‘between string and integer’.

I want my PHP script to send “0xfb” to the agent.
The Imp takes that Hex value and uses it in a serial output.

agent.on(“data”, function(value) {
// value is “0xfb”, but it’s a string.

function writeSerial(value) {
local outputs = value; // ??
local address = 0x00;
hardware.uart12.write(0xff); // write all ones to make sure TI sees the first start bit on the next line.
hardware.uart12.write(format("%c%c", 0x01 | (address <<1) | (outputs & 0x0f) <<4, 0x01 | (address <<1) | (outputs & 0xf0)));

Never mind …

I figured out that I can use an integer 0 to 255.

It’s working great, so when I finish the final circuit board and test, I’ll post schematic and example scripts.

For those following along, this TI chip allows you to have 8 digital outputs using 2 imp pins (pin 1 TX, UART). This is output only, so pin 2 (RX) is left unused. Because the TI chip is addressable, you can extend another chip for another 8 digital outputs … or more. The TI chip has three bit address, so you can have 8 of them X 8 digital outputs … Addresses 0 to 7. That means 64 digital outputs using 2 imp pins (pin 1 and pin 2) UART12

Check out this guys application using the TI chip.

Looks very usefull. One chip does 3v3 to 5v (or 12v) level shift, can sink 40mA
and has 8 outputs. As previously said the 3 address lines suggest 8 chips can hang on the same imp UART line giving 64 outputs - per UART

I am not clear however what stops the chip “getting out of sync” with the imp UART. May be set the imp to give 2 stop bits to give a small rest period?

It was only yesterday I finally got my first imps to blink up so I think it will be a while before I get to play with it!



I’m that guy.

I chose that particular serial-to-parallel chip because it doesn’t require an external clock or timing. It syncs itself, with a maximum speed of 24KBS (19200 baud is the highest with UART). The series of bits and specifically the transition of them is the key factor. The use of 3.3V for input and 3-12V output is also great for controlling things without burdening the imp/april board. I use a separate 5VDC regulator for the TI chip output in my project.

In my application, which is working great (Christmas Light Display), I send it one burst of serial data and it sets the eight pins. I am not continually sending data. I did read that in some real-world applications some people have had to send a hex F (binary 1111) in-between the words to provide a “rest period”. I have yet to experiment with sending continuous serial bits (many frames of data).

There are other serial-to-parallel chips out there and you could even make your own using a chain of flip-flops. Nothing I have found is as simple to use as that TI chip. After Christmas, when my display comes down, I’m going to experiment with adding more TI chips to test the addressing of them.

For any imp project you have, make sure you get a breadboard so you can move wires and components around without soldering. Protect all imp/april pins as much as you can so no voltages, spikes, over current occurs. It is easy to blow out a pin. Check your wiring carefully before you power-on your project.

The imp is very addicting. Have fun with it and try new things. Keep us posted on the project(s) you work on.