This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Can SSI2 port of TM4C1294 QSSI work as slave in QUAD or BI -mode ?

Got SSI2 of the TM4C1294 working in LEGACY mode as master and slave and in QUAD_WRITE mode as master, but didn't get it working as slave in QUAD_READ nor BI_READ mode. Are the advanced BI/QUAD modes supposed to work in slave configuration ?

  • Hello Thomas,

    For the availability of Adv-Bi-Quad feature please check the value of the SSIPP register at offset 0xFC0 of the SSI-2 Base Address. if the Value of the register is 0xD then the feature is available.

    Regards
    Amit
  • Hello Amit,
    Yes, this register has the value 0xd, what is in line with datasheet of the TM4C1294. The Bi-Quad feature is available and - as said - I got it working when it runs as an Quad-SPI-master. But I have no success, when I want to use the same port as an Quad-SPI-slave, although I supply clock, frame sync, and data from an external FPGA. It works fine as an Legacy(1 bit)-SPI-slave. But the Legacy SPI slave mode is not fast enough for my application, therefore I need Bi or better Quad mode.
    Thomas
  • Hello Thomas,

    Can you please share the configuration of the SSI in Bi-Quad Slave mode. And how is the application sofwtare read-writing the data to/from Slave?

    Please note that there is an errata (not published yet) in the manner which the slave module transmits the data on the bus.

    Regards
    Amit
  • Hi Amit, as I continue to insist, IF Forum get split from ROOT to peripheral and specific sub forum to address these problem is more simple to collect all data and see what happen on that service than trying to dive in a biggest inform mass of intermixed data. Preselected data can be read and see from one has that specific trouble.

     TIVA is too complex to leave all in one container.

  • Thomas Heinke said:
    Got SSI2 of the TM4C1294 working in LEGACY mode as master and slave and in QUAD_WRITE mode as master

    Thomas - we cannot tell if you succeeded w/QUAD_READ mode as master - might you explain?

    Like you - our small group requires faster data transfer - only possible via quad.  

    Perhaps you can further detail "when/where" your effort fails when (as Slave) in "Quad_Read" mode?  We've used another's M4 - and that has worked for us.  Sometimes - the speed of (this vendor's) SPI must be dialed (far) down when in Slave mode.  (at least that was true historically - we've not used 129 devices...)

    Follows a "swag" - more than once we've found that the main Peripheral Port is, "most extensively tested/verified" - thus I suggest you try w/SSI1.  (we've noted this @ several ARM MCU vendors - not just here...)  Again - your report of, "Failure when in Slave mode" deserves a close read of SSI section w/in MCU manual - to see if SSI data rates must be "dialed down."

  • Hello Amit,
    I used "spi-master.c" from "TivaWare_C_Series-2.1.0.12573\examples\peripherals\ssi" as a starting point. here are the essentials.
    Thomas

    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);

    GPIOPinConfigure(GPIO_PD3_SSI2CLK);
    GPIOPinConfigure(GPIO_PD2_SSI2FSS);
    GPIOPinConfigure(GPIO_PD0_SSI2XDAT1);
    GPIOPinConfigure(GPIO_PD1_SSI2XDAT0);
    GPIOPinConfigure(GPIO_PD6_SSI2XDAT3);
    GPIOPinConfigure(GPIO_PD7_SSI2XDAT2);

    GPIOPinTypeSSI(GPIO_PORTD_BASE, GPIO_PIN_7 | GPIO_PIN_6 | GPIO_PIN_3 | GPIO_PIN_2 | GPIO_PIN_1 | GPIO_PIN_0);
    SSIConfigSetExpClk(SSI2_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_0, SSI_MODE_SLAVE, 1000000, 8); // tried also SSI_MODE_SLAVE_OD
    SSIAdvModeSet(SSI2_BASE, SSI_ADV_MODE_QUAD_READ); //if this is commented out and the driving FPGA code is changed then it works
    SSIEnable(SSI2_BASE);

    while(1)
    {
    for(ui32Index = 0; ui32Index < NUM_SSI_DATA; ui32Index++)
    {
    SSIDataGet(SSI2_BASE, &pui32DataRx[ui32Index]); //hangs here
    pui32DataRx[ui32Index] &= 0xFF;
    }
    }
  • Hello cb1_mobile,
    I tried only QUAD_WRITE in master mode and succeeded, haven't tried QUAD_READ in master mode - would require significant changes in FPGA code, but might be the only option. The errata (SPMZ850C) says "SSI#03 SSI1 can Only be Used in Legacy Mode ".
    Turning the clock speed down (200kHz) was my first action when it failed - no success. I'm trying to "pump" data in, but the status bits never indicate that the Rx FIFO is full or at least not empty. If I read the data register anyway then it returns only 0x0 although I have sent something different from 0x0.
    Thomas
  • Hello Thomas,

    The basic rule of SSI is to Get a Byte you need to Put a Byte. When the configuration is done for Advanced Mode, it needs to be pushed into the FIFO. So after setting the Advanced mode do a SSIDataPut with a dummy byte before doing a SSIDataGer. I may have to search my code repository if I have a working example code (tough when the 1st of the month I am out of the office)
    Also move the SSIAdvModeSet after the SSIEnable.

    Regards
    Amit
  • Thomas Heinke said:
    I tried only QUAD_WRITE in master mode and succeeded, haven't tried QUAD_READ...

    Your use of the FPGA justifies - yet we're mystified as to the (effective) value of Quad_WRITE, only.  (in our experience - far more often we require Quad_READ to "pull" multiple font & image data from "massive" quad-based SPI storage devices.  We dislike this vendor's use of MCU code space for font/image storage!)

    To be clear - clock speed you dialed down was for SPI only - was that the case?  And - that clock must be from your external SPI device Master - not this MCU.  

    Thanks your quick, detailed response.   Salute what you're doing - quad SPI storage devices (and others) offer great speed-up over single bit parts - we'll (never) go back!

  • Hello Amit,

    I think your "basic rule" applies only to the master mode. One needs to "Put" to start the clock and a frame sync. In slave mode, where external logic is producing the clock and the frame sync, it doesn't seem necessary to "Put" before you can "Get".

    When I used the "Legacy slave mode" (and had the FPGA generating the clock an frame sync) I got data just with "Get".

    I'll try to move SSIAdvModeSet after SSIEnable tomorrow, it's a little late to do work today.

    Thomas

  • Yes, I did lower the SPI clock, generated from the external FPGA and the TM4C1294 was still running at 120 MHz, the SSI prescaler was set to the minimum value of "2" the baudrate register was set to also to the minimum value "0". If I got it right, then it should allow for a maximum SPI clock of 10MHz in slave mode.
  • Those settings appear (from my "unused that device" perspective) "Good for Gov't Work." We note that few (other) ARM MCUs enforce so potent a speed restriction when operating in Slave SPI modes.

    While awaiting "officialdom" you may wish to consider "bit bang" to manage (only) that read of the quad data. (we did such w/another's MCU - and then chose newer/improved (and less costly) device - which worked flawlessly - both master & slave!

    BTW - I agree w/you - vendor here is buried in (endless) repeat neophyte explanations - sometimes "dulling" analysis. Just as you assert - that external clock dictates SPI data - NO "Put" should be required when receiving data as SPI Slave. Do consider a bit-banged port read - not that hard - and frees you from (present & future) gremlins - apparently lurking your MCU...

  • Hello Thomas,

    And to slave in Adv-Bi-Quad Mode.

    From the data sheet for the Advanced Modes "For a data transmit, the 8-bit data packet is placed in a TX FIFO entry bits [7:0] and the mode of operation is inserted in the three most significant bits of the TX FIFO entry. The mode of operation bits [15:13] in the TX FIFO are used by the QSSI module for configuring the data on the proper pins."

    The Slave needs to be made aware as well on the type of Advanced Mode of Transfer, so it needs to be Pushed into the FIFO and then taken into Slave State Machine.

    Regards
    Amit
  • It's quite clear that the absence of any "reasonable" examples for both Bi & Quad SPI Peripheral management causes such concerns.

    As the Master device - not the (slaved) MCU - in poster's (read Quad SPI data) case - generates the SPI clocks - the use of "Put" prior to "Get" (still) seems of little merit...  (that was poster's {yet unanswered} question - we believe...)

  • Amit and cb1_mobile,

    - moving SSIAdvModeSet after SSIEnable doesn't help

    - bit banging will not work for me, the data input needs to happen in the background via DMA (haven't worked on this topic yet)

    - making an output before input WORKS (thanks to Amit for pointing into this direction), a single output with bits[15:13] properly set seems sufficient, it doesn't need to be done for every byte

    - in order to configure PD7 as SSI2XDAT2 it needs to be unlocked first

    QUAD_READ in slave mode works for me with the attached program fragment - have to work now on the DMA stuff for the complete solution.

    Thomas

    SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI2);

    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
    
    HWREG(GPIO_PORTD_BASE + GPIO_O_LOCK) = GPIO_LOCK_KEY;
    HWREG(GPIO_PORTD_BASE + GPIO_O_CR) = 0x80;
    
    GPIOPinConfigure(GPIO_PD3_SSI2CLK);
    GPIOPinConfigure(GPIO_PD2_SSI2FSS);
    GPIOPinConfigure(GPIO_PD0_SSI2XDAT1);
    GPIOPinConfigure(GPIO_PD1_SSI2XDAT0);
    GPIOPinConfigure(GPIO_PD6_SSI2XDAT3);
    GPIOPinConfigure(GPIO_PD7_SSI2XDAT2);
    
    GPIOPinTypeSSI(GPIO_PORTD_BASE, GPIO_PIN_7 | GPIO_PIN_6 | GPIO_PIN_3 | GPIO_PIN_2 | GPIO_PIN_1 | GPIO_PIN_0);
    SSIConfigSetExpClk(SSI2_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_0, SSI_MODE_SLAVE, 1000000, 8);
    SSIEnable(SSI2_BASE);
    SSIAdvModeSet(SSI2_BASE, SSI_ADV_MODE_QUAD_READ);
    
    SSIDataPutNonBlocking(SSI2_BASE, 0x4000);
    
    while(1)
    {
    	for(ui32Index = 0; ui32Index < NUM_SSI_DATA; ui32Index++)
    	{
    		SSIDataGet(SSI2_BASE, &pui32DataRx[ui32Index]);
    		pui32DataRx[ui32Index] &= 0xFF;
    	}
    }
    

  • Hello Thomas,

    You don't need to write 0x4000. Even a dummy write of 0x00 would do the same as the SSI Core manages the FIFO.

    Regards
    Amit
  • Amit Ashara said:
    Even a dummy write of 0x00

    Perhaps - but one must remain mindful that MCU (here) is SPI slave - and it's emission of any data to the SPI master - must comply w/any/all master's data requirements...  Thus (some) care must be employed in the selection of the "dummy write."

    We note that this dummy write seems not to be a "universal requirement" (by other M4 MCUs - equipped w/Quad SPI capability...)  Clocks from the master (alone) fully enable SPI data reception by those MCUs...

  • Hello cb1,

    I agree that the CLK and CS from master should be the only criteria but at the point of definition it was supposed to allow change from one mode to other which was made possible by having such a scheme feed to the Slave controller.

    Regards
    Amit
  • Hello Amit,

    You are right, a dummy write of 0x00 works as well as the 0x4000. I tried 0x4000 because of this statement from the datasheet, that you had quoted too.

    "The mode of operation bits [15:13] in the TX

    FIFO are used by the QSSI module for configuring the data on the proper pins."

    Re. cb1's concern: The Quad mode works only half-duplex and it is set into READ-mode. In addition my FPGA will never receive any data via SPI, so a dummy write cannot do any harm. For a bi-directional connection dummy data in the stream can be a problem - fortunately not in this particular application.

    I guess, we can close this discussion.

    Thomas

     

  • Hello Thomas,

    Even if you write the value the core will overwrite it, so both are equally correct.

    However cb1's question was much more beyond the issue. It was (correct me cb1) on how SSI is seen as an interface in products and how the module must have been done (which would have saved you the issue of doing a dummy write).

    Regards
    Amit
  • Amit Ashara said:
    ...cb1: How SSI is seen as an interface in products and how the module must have been done (which would have saved you the issue of doing a dummy write).  

    You are correct, Sir.  While you earn kudos for satisfying Thomas - the "non-standard" interface mechanism may very well "impede" the added speed which is - after all - the "raison d'etre" for QUAD SPI.

    One hopes that (forced) dummy write is "temporary" and that more normal/customary QUAD SPI transfer protocols may be accommodated...

    Doubtful that "too many" will find this post - extract this (very insider/extra dummy transfer write) under QUAD_SPI_READ - and avoid Thomas' (delayed/pained) fate...