Author Topic: Way to make it confusing  (Read 1781 times)

0 Members and 1 Guest are viewing this topic.

Offline bsonTopic starter

  • Supporter
  • ****
  • Posts: 2270
  • Country: us
Way to make it confusing
« on: November 10, 2021, 03:49:10 am »
How's this for an SPI timing diagram?

Not the BUSY output.  And the apparent DCLK stretched for its falling edge to coincide with BUSY.  WTF?!

But then look at the "detailed" timing diagram.  No clock stretching?  It's basically just saying BUSY consumes one cycle, during which there will be no meaningful data output.  Fair enough.  But then why have a BUSY output at all, why not just say the MSB of the first byte will always be '1' (assuming MISO isn't driven)?  Or drive it to '0' just to be nice?  Actually, the diagram DOES show it driven to '0'. So... huh.

In the end, I think all I'm looking at here is plain old SPI and can ignore the BUSY output.  So it's DMA friendly.  It's just the 12-bit data will be in bits 3-14 of a 16-bit big-endian word.



« Last Edit: November 10, 2021, 03:59:14 am by bson »
 

Online PCB.Wiz

  • Super Contributor
  • ***
  • Posts: 1540
  • Country: au
Re: Way to make it confusing
« Reply #1 on: November 10, 2021, 05:30:06 am »
And the apparent DCLK stretched for its falling edge to coincide with BUSY.  WTF?!...

In the end, I think all I'm looking at here is plain old SPI and can ignore the BUSY output. 
Hmm, who is in charge of BUSY ?
If it is the SPI device, my reading is that busy goes HIGH on last control/command clock, and remains high until some subsequent clock edge sees it go low.
ie the clock does not stretch, but at least one clock is needed to poll BUSY

Easy to check on a real device ?
If you want to ignore BUSY, some lower speed clock could make that possible ? does the data give a widest value needed for BUSY (may vary with command)
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21681
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Way to make it confusing
« Reply #2 on: November 10, 2021, 10:28:14 am »
If BUSY is not an async signal, it doesn't make any sense at all to provide separately; it should just be a status bit in the next frame.  Where there's evidently a suspicious gap that it would fit perfectly in.

Not doubting your interpretation of the diagrams; more to say, I agree, there's probably some dumb design going on here.

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline NorthGuy

  • Super Contributor
  • ***
  • Posts: 3146
  • Country: ca
Re: Way to make it confusing
« Reply #3 on: November 10, 2021, 02:30:20 pm »
You don't say who's the master, what is the direction of the signals (e.g. is DIN looks like MOSI, but we can only guess).

Looks like BUSY is gating the clock for DOUT, that is DOUT is valid only when BUSY is low. The diagram shows BUSY gets low after the first clock, but if the clock pulse occurs earlier, or if  the chip is busy doing something, the BUSY may go low after the second, third, or subsequent clock pulse.

This should be explained in the datasheet.
 

Offline Bassman59

  • Super Contributor
  • ***
  • Posts: 2501
  • Country: us
  • Yes, I do this for a living
Re: Way to make it confusing
« Reply #4 on: November 10, 2021, 05:45:28 pm »
How's this for an SPI timing diagram?

SPI is a completely meaningless initialism.

The timing diagram you posted is not what we think of as "SPI" -- it's just a wacky synchronous serial interface.

The hilarious -- by which I mean "completely hateful" -- thing is that nonstandard wacky synchronous serial interfaces are, uh, standard on low-pin-count multichannel converter chips.

The interfaces are all pretty goddamn stupid.

And this is one reason why I'm thankful I use FPGAs to talk to them. Instead of trying to force a microcontroller's standard SPI or USART peripheral to deal with these things, I just code up the exact interface I need. This of course assumes that the data sheet is comprehensive and correct.

In the "jeez, it would be nice" category: It Would Be Nice if the converter manufacturers could supply a bus-function HDL model of their parts for the customers to use to verify their FPGA designs, so I don't have to write them. There is nothing like using the same assumptions for design in the verification, right?

And It Would Be Really Fucking Nice if the manufacturer tech support response to "Do you have VHDL models of your converter ADCxxxx?" was not "You can find the IBIS models here ..."

Anyway.
 

Offline bsonTopic starter

  • Supporter
  • ****
  • Posts: 2270
  • Country: us
Re: Way to make it confusing
« Reply #5 on: November 10, 2021, 06:54:07 pm »
Yeah, this is the datasheet for a device and the signal is output by the decice.  I don't actually have the BUSY signal on the header I use to talk to the device, all I have is the other signals.  The device is a TSC2046 resistive touch controller on a display board.  (Or, more likely, a Chinese clone - but it seems to work like the original.  Not rocket science exactly.)

It doesn't say much about the pin other than it indicates the device is busy...

If it's a predetermined quantity I don't even understand why it's there.  The device already has an interrupt out to signal a touch event.  Perhaps they envision an interrupt-driven master that sends a command, then on an interrupt on BUSY reads the data?  But I don't see how this could work either; can't start clocking out the data (on DOUT/MISO) when it goes high, and its falling edge coincides with that of the clock.  So it can't be used for this.

But, I ignore it and feed ithe device a fixed byte sequence using DMA, capturing the data sent back using another DMA channel ("stream" in ST lingo, again talking of unncecessary complications, in this case redefining canonical terminology...).  Then extract the results from the rx buffer.  Like I said, it works just fine (or maybe that's just the clone?) - so why make the timing diagrams so complicated.   Shrug.
« Last Edit: November 10, 2021, 07:30:45 pm by bson »
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14466
  • Country: fr
Re: Way to make it confusing
« Reply #6 on: November 10, 2021, 07:20:46 pm »
While the detailed diagram seems to imply that the BUSY signal is held high only for exactly one clock cycle, this is something I would like to see written clearly in the documentation.
Plus, the confusing part is that in the first diagram, DCLK is shown interrupted during the BUSY high state, while in the second, DCLK keeps clocking. So. Without seeing the whole doc, I'd say to whoever did this: get a life. :-DD
 

Offline bsonTopic starter

  • Supporter
  • ****
  • Posts: 2270
  • Country: us
Re: Way to make it confusing
« Reply #7 on: November 10, 2021, 07:37:38 pm »
While the detailed diagram seems to imply that the BUSY signal is held high only for exactly one clock cycle, this is something I would like to see written clearly in the documentation.
Plus, the confusing part is that in the first diagram, DCLK is shown interrupted during the BUSY high state, while in the second, DCLK keeps clocking. So. Without seeing the whole doc, I'd say to whoever did this: get a life. :-DD
Agree totally.  There's a huge difference between "FYI - I'm doing a conversion now" and "woah, hold your horses, you can't read the results before the conversion is complete!"
 

Offline madires

  • Super Contributor
  • ***
  • Posts: 7764
  • Country: de
  • A qualified hobbyist ;)
Re: Way to make it confusing
« Reply #8 on: November 10, 2021, 08:10:51 pm »
Should be compatible with the ADS7843 which comes with a more comprehendible datasheet.
 

Offline NorthGuy

  • Super Contributor
  • ***
  • Posts: 3146
  • Country: ca
Re: Way to make it confusing
« Reply #9 on: November 10, 2021, 10:01:11 pm »
The device is a TSC2046 resistive touch controller on a display board.

The datasheet seems to imply that the part is fine with continuous clock (see "Figure 13. Maximum Conversion Rate, 15 Clocks-per-Conversion"). So, I'd say BUSY is purely informational.
 

Offline MarginallyStable

  • Regular Contributor
  • *
  • Posts: 66
  • Country: us
Re: Way to make it confusing
« Reply #10 on: November 10, 2021, 10:03:16 pm »
I get the impression that the busy signal is simply to indicate the time where the sample is taken. Not sure it is really needed for the interface.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf