TLV5621I SPI interface confusion

Go To Last Post
28 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Fellow Freakers,

 

I am going to try and work a personal project into my quest for gainful employment using the TLV5621I quad 8 bit DAC in MODE0 to control some special LED lighting I have with my CRESTRON system.

 

Datasheet found here:

http://www.ti.com/lit/ds/symlink...

 

Here's the issue I am having.  the device has a 12 bit internal latch - 8 bits data and 4 bits address for the data word and 12 bits for the control word.(the datasheet says 11 bits, but the timing diagram seems to show 12).  I want to use the AVR SPI engine, but it outputs only 8 bit bytes.  The timing diagrams in the DAC datasheet show 12 bits being clocked in then the EN line pulses LOW.

 

I am wondering how to get the AVR to conform to this format using the SPI engine.  I would prefer NOT to have to bitbang this if at all possible, but based on the datasheet I am thinking there is not going to be much choice as and extra bits I shift are going to be put into the next DAC, potentially screwing that ones output up, or it will mess up the DAC I am updating.  Not quite sure.

 

Since the DAC Data is 12 bits I was thinking about a structure of 6 bytes, but from the timing diagrams it would appear that a short idle time between data blocks occur so this may not be an option.  This also does not solve my issue with the control word either.

 

I do not have any preference of AVR on this one.  I was thinking about using my trusty Mega324 but I dont need the I/O....just SPI, a USART and a couple of I/O pins....not as many like the 324 has.

 

The main reason for going with this part is price.  If I can get this to interface to the SPI engine in the AVR great.  If not, then I have to decide on going with a 10 bit DAC(overkill) with a 16 bit data/control word and almost 3x the price, or two 8bit dual DACs that also have 16bit data/control words and are combined about $3.00 more(almost worth it just to not have a headache).

 

Any suggestions on what to do on this one?

 

Jim

This topic has a solution.

If you want a career with a known path - become an undertaker. Dead people don't sue! - Kartman

Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB user

Last Edited: Fri. Aug 3, 2018 - 03:47 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have found that if you send 2 x 8 bits out with the extra bits as zero works for OTHER devices, may be worth a shot.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Heres the rub John,

I have nothing to experiment with.  I am going to have the boards built by my vendor as I really do not have the time/patience/eyesight with SMD and the cost to have them source the parts/build is not going to break my bank.

 

I suppose I could order a device or two and an adapter board and give it a go on a breadboard.  I also found some BitBang code I have that I could certainly modify to do the task.

 

Hmmmm

 

I guess I could change the thread to a poll of "Should Jim take the plunge and get the bitbang to work/try johns suggestion, or should Jim simply wimp out and use two MAX522 DACs and move on?"

 

 

Decisions decisions

 

JIm

If you want a career with a known path - become an undertaker. Dead people don't sue! - Kartman

Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

js wrote:
if you send 2 x 8 bits out with the extra bits as zero works for OTHER devices, may be worth a shot.

Upon reading the datasheet again the extra bits might have to be sent BEFORE not AFTER the valid data due to the CS pulse latching the 12 bits.  Might just have to order that part and an adapter board and play.

 

Then again, I could really go overboard and use a micro from Atchip-Micromel that has DACs in it.....expensive though

 

JIm

If you want a career with a known path - become an undertaker. Dead people don't sue! - Kartman

Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Xmega32E5 has one two-channel, 12-bit. Not that expensive.

 

The ATxmega128A1U / ATxmega64A1U have "Two Two-channel, 12-bit, 1msps Digital to Analog Converters" if you really need 4 channels.

 

Don't know how the SAM devices stack up with DACs.
 

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The xmega would truly be a big jump for me. I started to do a few things with a 32e5 with Larry count, but stopped when I started finding issues with START, and the project being cancelled. I do need at least 4 channels.

Jim

If you want a career with a known path - become an undertaker. Dead people don't sue! - Kartman

Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB user

Last Edited: Sat. Aug 4, 2018 - 04:44 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jgmdesign wrote:
TLV5621I

It's a TI chip - have you asked on the TI forums ... ?

 

EDIT: http://www.ti.com/product/TLV5621/support

 

to control some special LED lighting

Did you know that there are some of those "smart" LEDs available with proper, real SPI drive?

ie, you don't have to bit-bang that weird WS2811 protocol stuff ...

 

 

 

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Fri. Jul 27, 2018 - 09:43 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I was going to say that some of Atmelchip's larger devices have SPIs where the bit length is configurable - not fixed at 8. Can't remember if this includes Xmega or whether it's just UC3 and SAM ?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jgmdesign wrote:
I do not have any preference of AVR on this one

But you do want it to be an AVR ?

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

@andy
The led lighting I am controlling is not those pesky WS2811 thingies. I am controlling overhead room lighting that takes a 0-10vdc control signal. There are 4 units hence 4 channels and they are to be controlled by 4 independent signals.

I was going to consult the TI forums today. I did not last night as it was very late and I was finishing up when this idea hit me and quite frankly I figured to get a nice collection of ideas from this lot of characters here than in the stuffy TI forums.(that was a compliment)

Yes I would like the controller to be an AVR but I could take the XMEGA plunge, but this project is so simple that the XMEGAS would be overkill
Cliff
I won't use a UC3 for obvious reasons and a SAM would be quite overkill as well. It would be a good first project I would admit as I know what the CRESTRON does and I know how the lighting works so that would cut down on the headscratching.

Still an AVR could do this in its sleep for the most part. I looked at the bit bang code and it's not a big deal for the most part.

Will head off to the TI forums and see what they say

Thanks
Jim

If you want a career with a known path - become an undertaker. Dead people don't sue! - Kartman

Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB user

Last Edited: Sat. Aug 4, 2018 - 04:46 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

0-10V control of lighting was old skool when i did architectural lighting back in the late 80’s. DALI was meant to surplant analog. 64 channels on one pair makes things easier. Anyways, the ti device might only accept the last 12 bits sent to it, so send 16 bits with your 12 bits correctly aligned. Of course, asking TI is hopefully going to get a concrete answer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jgmdesign wrote:
takes a 0-10vdc control signal.

I guessed it would probably be something like that, as you're using a DAC - but you never know ...

 

I hadn't heard of the SPI-controlled LEDs until recently.

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jgmdesign wrote:
a SAM would be quite overkill as well

Really?

 

Even the D10/20/21 ?

 

EDIT

 

Just checked the SAMD21 datasheet:

Each transaction can contain one or more characters. The character size is configurable, and can be either 8 or 9 bits.

So that doesn't help you anyhow.

 

sad

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Fri. Jul 27, 2018 - 11:18 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

How much else is the micro doing?

 

If it is reading a couple ADC pots or sliders to read the lighting level, or receiving lighting commands over the USART, then I would think the AVR would have lots of time to spend on bit-banging.

 

I know you said you really don't want to bit-bang this project, but it seems the workarounds are likely harder than just writing a function to accept the lighting channel number and the DAC value and bang some bits.

 

If you order 1/2 dozen chips to play with, send me two of them!

(But then you'd have to learn a new language to use my library...)

 

JC

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jgmdesign wrote:
I am controlling overhead room lighting that takes a 0-10vdc control signal ... CRESTRON ... 

So something like this, then:

https://www.crestron.com/en-US/Products/Lighting-Environment/Integrated-Lighting-Systems/Dimming-Modules/CLX-2DIMFLV8

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There seem to be several PIC16F17xx parts with 4 DACs ...

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:
the ti device might only accept the last 12 bits sent to it, so send 16 bits with your 12 bits correctly aligned. Of course, asking TI is hopefully going to get a concrete answer.

 

I'm with Kartman on this, as I don't see why this would not work!

 

You can do it Jim!

 

 

Jim

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Great Scott, great feedback!

 

@Andy,

Yes, that CRESTRON module I am aware of.  And I am aware of the price tag associated with it even with my dealer discount, and for what I need to do that is truly OverKill.

 

@Kartman and KiBOk

I have not hit the forums at TI yet today...someone want to pay me to do something so guess what takes priority?  I will ask later on though but I tend to agree that the framing of the data with the upper four bits being zeros should do the trick.

 

 

DocJC wrote:
If you order 1/2 dozen chips to play with, send me two of them!

No Problem.  Planning on dimming some LED' lights too?wink

 

JIm

If you want a career with a known path - become an undertaker. Dead people don't sue! - Kartman

Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

The xmega would truly be a big jump for me.

Only if you use Start/ASF wink, otherwise you will quickly get used to the chip even if you use ASM. Using C may even be simpler for a C guru like you.......

 

The Yamaha keyboard project a did earlier this year used a Xmega128D4, code size just under 64K from memory.

 

I could of course rebuild the project and tell you exactly if the blasted upgrade to AS 7.0.1645 in order to use the Tiny4809 did not kill Studio!! angry Now the working program does not compile and comes up with several errors.

 

The beauty of "those pesky WS2811 thingies" is that they are static, so unless you are trying to create a twinkling starry, starry night with the "overhead room lighting" you send them a packet and they will remember it for as long as power is on.

 

But it's your project, I hope we are confusing you enough....cheeky

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

js wrote:
The beauty of "those pesky WS2811 thingies" is that they are static, so unless you are trying to create a twinkling starry, starry night with the "overhead room lighting" you send them a packet and they will remember it for as long as power is on. But it's your project, I hope we are confusing you enough....cheeky

 

Ok, for the record:

jgmdesign wrote:
I am controlling overhead room lighting that takes a 0-10vdc control signal. There are 4 units hence 4 channels and they are to be controlled by 4 independent signals.

 

Thats it.  No more talk/type about "those pesky WS2811 thingies"!!

 

I have been cleaning out the lab lately...giving away the better goodies, scrapping the crap.  Once I am done with that I am going to sit down and reintroduce myself to the Xmega32e5 Using START/ASF and also trying to do it raw configuring the peripherals.

 

I also have some Tiny1616's to get to know better as well.

 

All this for another thread though.

 

Off to the TI forums I go. 

 

JIm

If you want a career with a known path - become an undertaker. Dead people don't sue! - Kartman

Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:

There seem to be several PIC16F17xx parts with 4 DACs ...

 

I looked at those parts and they come with two 8bit DACS and the rest are 5bit DACs  I would order a couple to see what I can do but unlike Atmel there is no STK type platform with a routing card and socket card, or an XPLAIN.  Theres only an emulator extension that costs $50.00 but the tool it only works with is $500.00

 

I have a pickit3 but without a board made this is off the table.

 

Thanks for the lead though

 

JIm

If you want a career with a known path - become an undertaker. Dead people don't sue! - Kartman

Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This fig. suggests that you can send 16 bits and force the chip to ignore the first 4 bits, by keeping the EN line low:

 

You could use a timer in PWM mode to modulate the EN line with the correct low and high times, so most of the work would be done in hardware.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, but in the case of the SPI engine in the AVR, I wont know when those four bits have left in order to flip the enable.

 

JIm

If you want a career with a known path - become an undertaker. Dead people don't sue! - Kartman

Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

My idea was you could start a timer at the same time as you send the first SPI byte, so at the right time (that is, after about 4-4.5 SPI bit times), enable is activated, maybe using an ISR, maybe using a timer output as the enable line.

If the SPI bit rate is not very high, I think this would not be so difficult.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well I heard back from Texas Instruments:

Hi James,

Although there is no clear spec in the datasheet, I think you should make the 16-bit packet MSB-aligned and append zero's at the end instead of appending them in the beginning. This should work. Please try it out.

Please let me know in case you face any issue.

Regards,
Xxxxxx

So, basically the poor fool that replied has no idea either.  From what I am seeing and based on the datasheet, appending zeros to the end would not align the data properly so it looks like I am on my own.  The data stream looks to be Mode 0 so once the parts arrive I shall see what I can do.  Funny, this part has been around for a long time.  One would think there would be some app notes on it and such but not a lot of information.

 

Oh well.  We shall see.

 

Jim

 

If you want a career with a known path - become an undertaker. Dead people don't sue! - Kartman

Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB user

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

SUCCESS!!

 

My parts arrived from Digikey this afternoon and after I finished my days responsibilities its time to play.  The application Engineer at TI was incorrect in telling me to pad the last 4 bits as logic 0, my initial thought of padding the first 4 bits as logic 0 did the trick.  I can update one, two, or all the DACS in a single write.  I can also disable them as well.

 

I did make one mistake, and that was identifying the MODE.  From the datasheet it looks like Mode0 as the timing diagrams all show the clock starting in a logic low state, when in reality the chip is looking for the clock to sit at a logic high state at idle.  Took a few minutes to sort that out.

 

So, the chip works as follows:

12 bit control word. Format is 0, 0, 0, 0, 1, 0, MODE, RA, RB, RC, RD, SIA, SIB, SIC, SID, ACT

12 bit data word. Format is 0, 0, 0, 0, 1, 1, A1, A0, D7, D6, D5, D4, D3, D2, D1, D0

SPI MODE2

 

The datasheet explains the MODES 0/1 in some detail, but I elected to use MODE 0 as it resembles the AVR SPI engines operation.  The EN line works in REVERSE of what is considered normal operation, meaning the part is active when the SS pin is HIGH.  Also, strap the HWACT pin to Vcc and for normal operation set the ACT bit in the control register.  You can then disable the DACs individually using their corresponding SIx bit.

 

 

Time to work up a Schematic, PCB and BOM and send it off to the board house for fab/assembly! 

 

Thanks all for the input on this.

 

Jim

If you want a career with a known path - become an undertaker. Dead people don't sue! - Kartman

Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So Jim, will you educate "the poor fool" about his own product?

 

Ross McKenzie ValuSoft Melbourne Australia

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yeah I will reply to his email with the correction. He did say that he was not sure about his solution. Big help.

Jim

If you want a career with a known path - become an undertaker. Dead people don't sue! - Kartman

Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB user