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.

xRM46L852PGE mibSPI1 strange problem

Other Parts Discussed in Thread: HALCOGEN

Hi,

I found a strange problem with mibSPI1 working in slave mode. I am working on our custom board. The set up is:

mibSPI3 is used as a master and it does clocking  and chip selecting  for mibSPI1 and mibSPI5 simultaneously,  which are configured as slaves.  The goal is to receive 3 bit streams 32 bit long each from 3 spi ADCs. All SPIs are working in multi buffered mode where mibSPI3 controls the frame.  Both mibSPI1 and mibSPI5 were configured with CS, MOSI, SCLK lines being functional and MISO disabled since they did not transmit. There was no problem with mibSPI3 and mibSPI5: they transferred/received data. But mibSPI1 even configured exactly as mibSPI5 (the only difference was CS lines)  didn't  receive anything, even didn't see the chip select line activity. The buffer was in waiting state with no any sign of data. I spent quite time to figure out what happened until I made mib SPI1's MISO line functional as well.  After that mipSPI1 became functional and started seeing  the incoming stream. That puzzles me:  mibSPI5  works fine with MISO disabled.

I did not see errata for this behavior, even it doesn't make any harm in our case, where these lines are not used with other peripherals, it seems illogical.

Regards, Dmitri.     

         

  • Hello Dmitri,

    I will check on this behavior with our design team to see if there is any limitations that would only affect MibSPI1; however, I think the implementations should be the same. MibSPI5 IP supports parallel mode SPI which may be enough difference in the logic to somehow cause an unintended side effect. Once I have more insight, I will get back to you with further explanation.

  • Hello Dmitri,

    Out design team has reviewed your description of your setup and the behavior you are seeing is not as they would expect. Is it possible for you to post your project to this thread so we can review your setup and generate a test code for our design team to simulate what you are seeing? This will allow them to trace through the design to see what might be causing the problem or to see if there is something in your setup that needs to be changed.

  • Hi Chuck,

    The application is quite big now  to post it as it is. The spi3 master is working with DMA and all other slaves are read by DMA  as well so it makes hard to demonstrate it inside the app. What I can do, I may cut  out the spi code and  make a small test based on the setup  do demonstrate the problem. I would come to you later with the test result.  

    Regards, Dmitri. 

  • Hi Chuck,

    I isolated the code. It is not exactly the same as the application is using but it shows the problem. It was run on our board with xRM46L852PGE chip installed. Hardware wiring: mibSPI3 is the master clocking  (pin 53 )three 16 bit ADC chains (2 ADCs per chain, 6 in total ),  mibSPI1 (pin 95) and mibSPI5 (pin100) .  minSPI3 nSC0 (pin 55) is connected to ADCs, nCS5 for mibSPI1 (pin 91) and nCS0 for mibSPI5 (pin 32). ADC data lines are connected to mibSPI1 SIMO (pin 93), mibSPI3 MISO (pin 51), mibSPI5 SIMO (pin 99). As you can see SPI3 and SPI5  have data received; value ~16390 is valid code representing  the signal. Receiver flags show CS0. SPI1  receives only when SOMI is enabled.     

    Here is the output from the test :

      

    The project code is attached:

    5460.mibSPI1_TEST.zip

    Regards, Dmitri.

  • Dmitri,

    I was able to reproduce your problem on our HDK board.
    Can you confirm that the Halcogen project part of your zipped project is the one use to generate your application?
    I've tried to load it and can't see the correct definition for MIBSPI1, 3 and 5.
    So for now I'm using your generated code to see how everything is configured.

    In Multi Buffer Slave mode (MIBSPI1 and MIBSPI5 in your application) the CS lines are used to select which transfer group has  to be used.
    Using CS5 is not possible. Only CS0, CS1, CS2 and CS3 can be used.

    The following table assume all CS[3:0] are defined as functional.

    CS3 CS2 CS1 CS0
       0       0       0      0        Trigger TG0
       0       0       0      1        Trigger TG1
       0       0       1      0        Trigger TG2
       0       0       1      1        Trigger TG3
       1       1       1      1        Not selected


    Based on the number of TG your application needs, the number of CS to be used is configurable . If the CS is defined as functional, it will be used in the decode process.
    In your case, if only 1 TG is necessary, than only configure CS0 as functional and all other as GIO.

    Note: If you need more than 1 TG you will need more than 1 CS line between your master and your slave.
    It is also necessary to configure the master to generate "Encoded CS" instead of one hot CS.

    I understand that the TRM does not cover the MIBSPI in slave mode efficiently. We are working on a revised section for MIBSPI.

    Please let me know if I've answered your question and let me know the result for your application.

  • Hi Jean-Mark,

    The halcogen project was used for start up sequence generation only. Part of the code is based on halcogen generated code but not from this project and that code was modified. This is why you don't see proper chip select allocation - it was done manually based on actual hardware.

    Be honest I don' t understand the table you placed. It goes against TRM, you own API, and actual chip behavior.   

    As I mentioned in my original post, I found the walk around and it is not affecting my application, since we don't allocate SOMI line for mibSPI1. 

    Regards, Dmitri. 

  • Hi Jean-Mark,

    As you can see in my post showing a debug listing, SPI1 slave is perfectly triggered by SC5 line configured for TG0. CS5 was decoded in the status register (0x1F). 

    Regards, Dmitri.

  • Dmitri,

    In MIBSPI Slave mode, the CS lines are used to specify which Transfer Group in the slave MIBSPI has to be used.
    To do so, depending on how many transfer group you want to use in your slave MIBSPI, 1 to 4 CS have to be used to trigger TG0 to TG14. (TG15 cannot be used in slave mode, see the table)

    The valid CS in this mode are CS0, CS1, CS2 and CS3.
    If only 1 TG is necessary, CS0 has to be defined as functional pins, CS1, CS2 and CS3 as GIO. Other CS lines (CS5, CS6) are not used in this mode.
    If more than 1 TG are used in an application, than the following table has to be used.

    CS3 CS2 CS1 CS0 (if all defined as functional)

       0       0       0      0        Trigger TG0
       0       0       0      1        Trigger TG1
       0       0       1      0        Trigger TG2
       0       0       1      1        Trigger TG3
       0       1       0      0        Trigger TG4
       0       1       0      1        Trigger TG5
       0       1       1      0        Trigger TG6
       0       1       1      1        Trigger TG7
       1       0       0      0        Trigger TG8
       1       0       0      1        Trigger TG9
       1       0       1      0        Trigger TG10
       1       0       1      1        Trigger TG11
       1       1       0      0        Trigger TG12
       1       1       0      1        Trigger TG13
       1       1       1      0        Trigger TG14
       1       1       1      1        No TG selected   (TG15 cannot be used)

    Again, depending on the number of TG, multiple CS line will have to be connected between the Master and the Slave (up to 4 for a full TG decode)

    Back to your application, in the actual state, the MIBSPI1 has all CS[3:0] as GPIO and CS5 as functional.
    MIBSPI1 behaves as a MIBSPI in 3 pins mode, and the reason it is "working" is in fact the MIBSPI1 does not care about CS at all. As soon as the TG0 is enable, regardless of CS5 state, the state machine is waiting for the SPI1CLK.
    Once the MIBSPI3 TG0 is enable, the MIBSPI1CS0 is activated, and the MIBSPI3CLK is started.
    The MIBSPI1 starts to shift data in.
    Because MIBSPI5 TG0 is configured to use CS0 and only CS0 is defined as functional pin, than here we have the correct behavior.

    If for test, you change on MIBSPI3 TG0 definition to use CS1 instead of CS0, you will see that MIBSPI1 is still able to receive, but MIBSPI5 will not receive anything anymore.

    Please have a try and let me know the result.

  • Hi Jean-Marc,

    Thanks for the explanation. If it is real spi design it should be in TRM since it doesn't mention any chip select decoder in spi's design description, not in buffer's description.  Anyway even SPI1 is  working in 3 pin mode, it doesn't explain why  it needs SOMI to be functional.   

    Regards ,Dmitri.



  • Hi Jean-Marc,

    I changed the spi1 select line to CS4 and disabled CS5. Yes it receives anyway with no CS active ( CS4 line is steady high)  which confirms you are right saying the spi1 doesn't care of CS at all and works in 3 pin mode synchronizing on the clock.

    Actually, all of this kills spi1 as slave with CS on PGE because CS[0-2] are heavily multiplexed with USB and MII and SC3 doesn't exists on PGE package.     

    Regards, Dmitri

  • Dmitri,

    You only need all CS[3:0] if you want to be able to trigger up to 15 Transfer Group in your MIBSPI1.
    If you only need 1 TG, CS0 is enough.
    Do you use USB or MII in your application?

    By doing more test using Halcogen, I've found some limitation in the generated code.
    Mainly Halcogen supports Master mode in the Transfer Group Tab.
    I will contact the software team to see what can be done to make is easier.
    At least, if the SPI is defined as Slave, the Transfer Group Tab should have some parameters grey out (Not applicable).
    Another point to highlight is in the definition of the CS for a given TG. Halcogen does not provide a way to used encoded CS. This is a limitation that should be fixed.

  • Hi Jean-Marc,

    Yes, USB0 is used and all other  CS pins are allocated as well. The only possible pin would be CS2 but it is also used already and, anyway, it is too late to reallocate it - the board is done. We will live with 3 pin mode.

    Regards, Dmitri.