Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 4 of 4

Thread: Guidance on feasibility of dual SPI MISO lines with Teensy

  1. #1
    Junior Member
    Join Date
    Oct 2019
    Posts
    2

    Guidance on feasibility of dual SPI MISO lines with Teensy

    Hi guys

    I'm new to the Teensy world, so appologies if this is trivial.

    I have an application where I need to use a high speed ADC. I'm using an LTC2341-18 Dual Simultaneous Sampling ADC.

    Datasheet: https://www.analog.com/media/en/tech...ts/234118f.pdf

    I have managed to get sustained sample rate of just under 350ksps per channel with two channels active, using the SPI and clocking at around 38MHz, albeit there is some noise, which I'll try and fix later. This seems to be the maximum SPI clock rate on the Teensy 4, as the SPISettings ask for a 50MHz clock, but instead, I only get around 38MHz.

    However, I would like to push the sample rate even further, and the ADC does allow higher throughput. The ADC has basically three SPI 'modes':

    1. Single MISO CMOS SPI:- SCKI, SDI, SDO
    2. Dual MISO CMOS SPI:- SCKI, SDI, SDO0, SDO1
    3. LVDS SPI:- uses LVDS drivers to reduce noise.

    To get more throughput, I'm thinking of making use of the dual, parallel, and simultaneous SDO (MISO) lines available. The issue is, both of the SDO lines are clocked with the same clock, and I don't know how best to implement that in Arduino - let alone if its possible.

    I understand I would have to tweak the SPI.h library, but any guidance on what area to focus on, and the path to take would be greatly appreciated.

    The forum post below touches on a similar situation but not quite the same.
    https://forum.pjrc.com/threads/47183...l=1#post157201

    I have attached the timing diagram of the ADC below.

    Click image for larger version. 

Name:	timing.png 
Views:	7 
Size:	39.9 KB 
ID:	17998

  2. #2
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    5,690
    First in questions like this it might help if you actually stated which Teensy you are asking about? And for example which pins you are thinking about. I am assuming a T4 from your one comment.

    But the simple answer is I don't think it is possible using the SPI. At least I have not seen any such ability... On any of these Teensy boards where you might see MISO0, MISO1... That typically implies there are more than one SPI buss on the chip. So
    SPI has (MOSI, MISO, SCK, CS) marked on card. SPI1 has (MOSI1, MISO1, SCK1, CS1), SPI2... That is each SPI Buss has it's own MISO pin...

    Now on T4 (as well as other boards), when you ask for speed of 50mhz the system tries to find the fastest speed it can run that does not exceed the speed that you passed in, where looks like 38mhz... There may be ways to bump this speed up, by mucking with which clock is passed into SPI subsystem...

    However with T4, there may be another way to do this. That is using FLEXIO...

    During the T4 beta, I played around some with it, and was able to create serial ports and an SPI port. The current stuff only does one (optional) MISO pin on it, but may be possible to add a second one. I also don't remember how fast I could get these to run...

    My stuff I played with is up on github at: https://github.com/KurtE/FlexIO_t4

    @Paul (if you read this thread) There are parts of it, that might be good to get into the core Teensyduino stuff, and also potentially the Serial port part of this could be used in something like SoftwareSerial...

  3. #3
    Junior Member
    Join Date
    Oct 2019
    Posts
    2
    Hi KurtE

    Yeah, it is on a Teensy 4.0, apologies, I had included it in my first draft, but I had to rewrite the post.

    I'll have a look at the FlexIO library. I presume you mean I can run at a faster clock on the FlexIO?

    Thanks

  4. #4
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    5,690
    What I was mentioning is it may be possible to get somewhat higher speeds on the main SPI.

    I thought there as a thread within the last couple of days on this, but my searches show one from last month:
    https://forum.pjrc.com/threads/57652...38mhz-possible

    There are 4 different clocks that can be fed into SPI subsystem. By default we are not choosing the fastest one...
    There is code in SPI.begin which chooses the clock and then there is code in beginTransaction, which looks what clock is actually currently active and generates a divisor from its speed... So if you change the clock after the begin in theory it should go faster...

    I am not sure why we did not choose the fastest one to begin with, but have been thinking about changing it to see if there are any issues.

    As for FlexIO maybe going faster. I don't remember. Again it goes off of the clocks and then need to see how that all funnels down into FlexIO and then figure out how the different parts work... What I was saying is it could be possible to make a version of the FlexIO SPI code to have the two logical MISO pins.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •