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.

MibSPI Communication between two TMS570

Other Parts Discussed in Thread: HALCOGEN

Have two TMS570 development boards with their MibSpi#5 connected together in a straight through connection.

One is configured as Master, the other as Slave.

Code is configured to use the TI supplied copy functions.

Code has been tested standalone in loopback (Master) mode.

Master-Slave mode,

Code has been reconfigured to run in Master Mode on Master, and in Slave Mode on Slave (first time in Slave Mode).

Master seems to take control of the MibSPI#5 Bus, evidenced by MibSpi5CLK, MibSPI5CS[0], and MibSpi5SIMO[0] toggling but MibSpiSOMI floating high (using ext clk per documentation).

Slave seems to be waiting (on ???)  to exchange data, MibSpiSOMI floating high (using ext clk per documentation).

MibSPI5->TGINTFLG shows 0x0;

MibSPI5 memory mapped registers(below) 0xff0a0000 to 0xff0a01fe  & 0xff0a0200 to 0xff0a02fe shows outgoing data loaded and incoming data as 0x0.

0xff0a0000 to 0xff0a01fe Transmit Buffer (Data to transmit)

980E 0000 980E 2383 980E 1002 980E 1003 980E 1004 980E 1005 980E 1006 980E 1007 980E 1008 980E 1009 980E 100A 980E 100B 980E 100C 980E 100D 980E 100E 980E 100F 980E 1010 980E 1011 980E 1012 980E 1013 980E 1014 980E 1015 980E 1016 980E 1017 980E 1018 980E 1019 980E 101A 980E 101B 980E 101C 980E 101D 980E 101E 980E 101F 980E 1020 980E 1021 980E 1022 980E 1023 980E 1024 980E 1025 980E 1026 980E 1027 980E 1028 980E 1029 980E 102A 980E 102B 980E 102C 980E 102D 980E 102E 980E 102F 980E 1030 980E 1031 980E 1032 980E 1033 980E 1034 980E 1035 980E 1036 980E 1037 980E 1038 980E 1039 980E 103A 980E 103B 980E 103C 980E 103D 980E 103E 980E 103F 980E 1040 980E 1041 980E 1042 980E 1043 980E 1044 980E 1045 980E 1046 980E 1047 980E 1048 980E 1049 980E 104A 980E 104B 980E 104C 980E 104D 980E 104E 980E 104F 980E 1050 980E 1051 980E 1052 980E 1053 980E 1054 980E 1055 980E 1056 980E 1057 980E 1058 980E 1059 980E 105A 980E 105B 980E 105C 980E 105D 980E 105E 980E 105F 980E 1060 980E 1061 980E 1062 980E 1063 980E 1064 980E 1065 980E 1066 980E 1067 980E 1068 980E 1069 980E 106A 980E 106B 980E 106C 980E 106D 980E 106E 980E 106F 980E 1070 980E 1071 980E 1072 980E 1073 980E 1074 980E 1075 980E 1076 980E 1077 980E 1078 980E 1079 980E 107A 980E 107B 980E 107C 980E 107D 980E 0000 800E 548A

 

0xff0a0200 to 0xff0a02fe Receive Buffer (incoming data)

8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000 8000 0000

Slave is not latching data off the MibSPI#5 (SIMO) Bus, and there is no simultaneous transmission of data from the Slave either (SOMI floating high).

We chose MibSPI#5 for throughput, this will be used for Inter-Processor Communication between two of out boards built around the TMS570 with Parallel Bus SPI.

 

George A Mitchell

george.mitchell@astronics.com

(425) 895-4337 Work

(949) 302-9867 CP

  • Hi George,

    Things to check:

      - You need to make sure all the pins you are using in SPI mode are configured as SPI Function (value 1) in SPIPC0.

      - Has the transfer group been triggered (in the slave too) by the TGxCTRL register?

      - Are the pointers in the TGxCTRL register setup correctly to point to the data you've written into the MibSPI RAM?

    Regarding the RAM dumps in you remail, were these both from the slave side?  (i.e. the transmit dump is also from the slave).

    If not please post the slave's transmit ram contents as well.

    And if the above doesn't help;  please post a dump of the MibSPI control registers so we can go through them and look for a problem.

    Best Regards,

    Anthony

  • Thanks for the help Anthony;

      - You need to make sure all the pins you are using in SPI mode are configured as SPI Function (value 1) in SPIPC0.

    ** Using HalCoGen generated mibspi files.

      - Has the transfer group been triggered (in the slave too) by the TGxCTRL register?

    ** Using HalCoGen generated mibspi files with mibspiTransfer functions.

    - Are the pointers in the TGxCTRL register setup correctly to point to the data you've written into the MibSPI RAM?

    ** Using HalCoGen generated mibspi files with mibspiGetData & mibspiSetData functions.

    Regarding the RAM dumps in you remail, were these both from the slave side?  (i.e. the transmit dump is also from the slave).

    ** Both are from the Slave side.

    If not please post the slave's transmit ram contents as well.

    ** -n/a-

    And if the above doesn't help;  please post a dump of the MibSPI control registers so we can go through them and look for a problem.

    MibSpi#5 Registers

    0xFFF7FC00

    00000001 01000000 00000000 00000000 00000200 0F0F0F0F 0001060F 0F00090A 0000000F 0000000F 0000000F 00000000 00000000 0F0F0F0F 00000000 00000000 80000000 80000000 00000000 0000000F 00005910 00005910 00005910 00005910 00000000 00000000 00000000 00000000 00000001 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00007F00 80700000 40700000 40700000 40700000 40700000 40700000 40700000 40700000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 0000C001 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000001 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000105 00000000 00000219 00000003 00000200 00000500 00590059 00590059 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 4A050305

    0xFFF7FE00

  •  

    MibSpip5   GlbCtrl0 0x00000001 Global control register 0 [Memory Mapped]   GlbCtrl1 0x01000000 Global control register 1 [Memory Mapped]   Int0 0x00000000 Interrupt Register [Memory Mapped]   IntLvl 0x00000000 Interrupt Level Register [Memory Mapped]   IntFlg 0x00000200 Flag Register [Memory Mapped]   Fun 0x0F0F0F0F Pin Control 0 [Memory Mapped]   Dir 0x0001060F Pin Control 1 [Memory Mapped]   DIn 0x0F00090B Pin Control 2 [Memory Mapped]   DOut 0x0000000F Pin Control 3 [Memory Mapped]   DSet 0x0000000F Pin Control 4 [Memory Mapped]   DClr 0x0000000F Pin Control 5 [Memory Mapped]   PDr 0x00000000 Pin Control 6 [Memory Mapped]   PDis 0x00000000 Pin Control 7 [Memory Mapped]   PSel 0x0F0F0F0F Pin Control 8 [Memory Mapped]   TxDat0 0x00000000 Transmit Data Register 0 [Memory Mapped]   TxDat1 0x00000000 Transmit Data Register 1 [Memory Mapped]   RxBuf 0x80000000 Receive Buffer Register [Memory Mapped]   Emu 0x80000000 Emulation Register [Memory Mapped]   Delay 0x00000000 Delay Register [Memory Mapped]   DefCs 0x0000000F Default Chip select Register [Memory Mapped]   DatFmt0 0x00005910 Data Format Register 0 [Memory Mapped]   DatFmt1 0x00005910 Data Format Register 1 [Memory Mapped]   DatFmt2 0x00005910 Data Format Register 2 [Memory Mapped]   DatFmt3 0x00005910 Data Format Register 3 [Memory Mapped]   TgIntVec0 0x00000000 Transfer Group Interrupt Vector Register 0 [Memory Mapped]   TgIntVec1 0x00000000 Transfer Group Interrupt Vector Register 1 [Memory Mapped]   SrSel 0x00000000 Pin Control Register 9 [Memory Mapped]   PmCtrl 0x00000000 Parallel/Modulo Mode Control Register [Memory Mapped]   MibSpiEna 0x00000001 MibSPI Enable Register [Memory Mapped]   TgIntEnaSet 0x00000000 MibSPI Transfer Group Interrupt Enable Set Register [Memory Mapped]   TgIntEnaClr 0x00000000 MibSPI Transfer Group Interrupt Enable Clear Register [Memory Mapped]   TgIntLvlSet 0x00000000 MibSPI Transfer Group Interrupt Level Set Register [Memory Mapped]   TgIntLvlClr 0x00000000 MibSPI Transfer Group Interrupt Level Clear Register [Memory Mapped]   TgIntFlg 0x00000000 Transfer Group Interrupt Flag Register [Memory Mapped]   TickCnt 0x00000000 Tick Cnt Register [Memory Mapped]   LTgPend 0x00007F00 Last Transfer Group End Pointer [Memory Mapped]   Tg0Ctrl 0x80700000 MibSPI Transfer Group Control Register 0 [Memory Mapped]   Tg1Ctrl 0x40700000 MibSPI Transfer Group Control Register 1 [Memory Mapped]   Tg2Ctrl 0x40700000 MibSPI Transfer Group Control Register 2 [Memory Mapped]   Tg3Ctrl 0x40700000 MibSPI Transfer Group Control Register 3 [Memory Mapped]   Tg4Ctrl 0x40700000 MibSPI Transfer Group Control Register 4 [Memory Mapped]   Tg5Ctrl 0x40700000 MibSPI Transfer Group Control Register 5 [Memory Mapped]   Tg6Ctrl 0x40700000 MibSPI Transfer Group Control Register 6 [Memory Mapped]   Tg7Ctrl 0x40700000 MibSPI Transfer Group Control Register 7 [Memory Mapped]   Tg8Ctrl 0x00000000 MibSPI Transfer Group Control Register 8 [Memory Mapped]   Tg9Ctrl 0x00000000 MibSPI Transfer Group Control Register 9 [Memory Mapped]   Tg10Ctrl 0x00000000 MibSPI Transfer Group Control Register 10 [Memory Mapped]   Tg11Ctrl 0x00000000 MibSPI Transfer Group Control Register 11 [Memory Mapped]   Tg12Ctrl 0x00000000 MibSPI Transfer Group Control Register 12 [Memory Mapped]   Tg13Ctrl 0x00000000 MibSPI Transfer Group Control Register 13 [Memory Mapped]   Tg14Ctrl 0x00000000 MibSPI Transfer Group Control Register 14 [Memory Mapped]   Tg15Ctrl 0x00000000 MibSPI Transfer Group Control Register 15 [Memory Mapped]   Dma0Ctrl 0x0000C001 MibSPI Dma Channel Control Register 0 [Memory Mapped]   Dma1Ctrl 0x00000000 MibSPI Dma Channel Control Register 1 [Memory Mapped]   Dma2Ctrl 0x00000000 MibSPI Dma Channel Control Register 2 [Memory Mapped]   Dma3Ctrl 0x00000000 MibSPI Dma Channel Control Register 3 [Memory Mapped]   Dma4Ctrl 0x00000000 MibSPI Dma Channel Control Register 4 [Memory Mapped]   Dma5Ctrl 0x00000000 MibSPI Dma Channel Control Register 5 [Memory Mapped]   Dma6Ctrl 0x00000000 MibSPI Dma Channel Control Register 6 [Memory Mapped]   Dma7Ctrl 0x00000000 MibSPI Dma Channel Control Register 7 [Memory Mapped]   Dma0Cnt 0x00000001 ICnt Register 0 [Memory Mapped]   Dma1Cnt 0x00000000 ICnt Register 1 [Memory Mapped]   Dma2Cnt 0x00000000 ICnt Register 2 [Memory Mapped]   Dma3Cnt 0x00000000 ICnt Register 3 [Memory Mapped]   Dma4Cnt 0x00000000 ICnt Register 4 [Memory Mapped]   Dma5Cnt 0x00000000 ICnt Register 5 [Memory Mapped]   Dma6Cnt 0x00000000 ICnt Register 6 [Memory Mapped]   Dma7Cnt 0x00000000 ICnt Register 7 [Memory Mapped]   DmaCntLen 0x00000000 Dma LARGE Cnt register [Memory Mapped]   UErrCtrl 0x00000105 Uncorrectable Parity Error Control Register [Memory Mapped]   UErrStat 0x00000000 Uncorrectable Parity Error Status Register [Memory Mapped]   UErrAddr1 0x00000219 Uncorrectable Parity Error Address Register [Memory Mapped]   UErrAddr0 0x00000003 Uncorrectable Parity Error Address Register [Memory Mapped]   RxOvrNBufAddr 0x00000200 Receive RAM Overrun Buffer Address Register [Memory Mapped]   IoLpbkTstCtrl 0x00000500 IO Loopback Test Control Register [Memory Mapped]   EXTENDED_PRESCALE1 0x00590059 Extended Prescale Register 1 [Memory Mapped]   EXTENDED_PRESCALE2 0x00590059 Extended Prescale Register 2 [Memory Mapped]   ECCDIAG_CTRL 0x00000000 ECC Control register [Memory Mapped]   ECCDIAG_STAT 0x00000000 ECC Diagnostic Status register [Memory Mapped]   SPIREV 0x4A050305 Revision ID Register [Memory Mapped] 

     

  • Thanks George,

    I'll look through these now and see if I spot anything.

    Best Regards

    -Anthony

  • George,

    How many chip select lines do you have wired between the master and slave?

    In slave mode, the multibuffer logic decodes the 4-bit value on SCS[3:0].   A value of 0000 triggers transfer group 0,  0001 triggers transfer group 1, etc.

    I see a value of 0xA in the data input register for the chip select bits.  So that would be selecting TG 10 which I don't think is actually enabled.

    If you only intend 1 chip select line between the two devices, then you should try changing the pin function bits for the SCS\ lines to 0001 instead of 1111 (F) as they are set today.   I think that alone might be enough to get some activity.

    Pls. let me know if this changes the behavior at all.

    Thanks and Best Regards,

    Anthony

  • That was it !!!

    Thanks, moving forward ....

  • Hi Anthony,

    I'm working with George on this issue and had a few questions.

    1) What is the relationship between SCS[3:0] (or /SPISCS[3:0] as defined in TRM 25.2.3) and the pin names MIBSPIxNCS[n:0] (as defined in the datasheet)?

    2) Why does a value of 0xA in the data input register correspond to TG 10 rather than SCS[3] and SCS[1]?

    3) We left the CS for unused TGs to the defaults set in HALCoGen which is the same value as the TG.  If a slave TG size is zero and assigned CS never goes low, does this interfere with the reception of non-zero sized TGs?

    Thanks, Charlie Johnston

    PS - We really appreciate your quick and accurate responses on this forum.  You seem to get assigned most of our questions, and we would be lost without your clarifications

     

  • Hi Charlie,

    Charles Johnston said:

    1) What is the relationship between SCS[3:0] (or /SPISCS[3:0] as defined in TRM 25.2.3) and the pin names MIBSPIxNCS[n:0] (as defined in the datasheet)?

    It's a 1:1 mapping.   Sorry about the name change.   The IP has been around for quite some time (getting close to 15 yrs) and has been on the TMS470R1x, TMS470M, and TMS570 series of parts so lots of people have touched the doc over time.   I'll enter a doc feedback submission on this point.   Also, if you spot other problem feel free to point them out on the forum or submit the feedback via the 'Submit Documentation Feedback" link that's in the footer of each page of our TRMs/Datasheets.

    Charles Johnston said:

    2) Why does a value of 0xA in the data input register correspond to TG 10 rather than SCS[3] and SCS[1]?

    Good question.   We have a section missing from our TRM that needs to be added describing how the MibSPI chip selects work in slave mode.

    In master mode, you get to pick the chip select that is asserted by each transfer group by programming this into CSNR field of the transfer group's transmit data register in the MibSPI RAM.   So there is no apriori mapping between chip selects and transfer groups in master mode.

    I should also add that in master mode you could program the CSNR field with a value of 0x0A and during the transfer it woudl assert both MibSPIxNCS[3] and MibSPIxNCS[1].  The MIBSPI doesnt' care if you want to use the chip selects as one-hot encoded or binary encoded or any encoding of your choice - it treats the CSNR field as just a 'pattern' to put onto the pins during the transfer.

    What we missed is the description of how chip selects work in slave mode.    In slave mode, the mapping is a binary mapping between the MibSPIxNCS[3:0] and the TG#.

    So the pattern '0000' selects TG0,  '0001' selects TG1,  '0010' TG2, and so on.  There is also a register "SPIDEF" that allows you to select the pattern that signifies all slaves deselected. 

    Now, I believe we suggested a workaround to the previous problem which was to configure only one of the MibSPIxNCS pins as a 'functional' pin and the rest as GIO.   By doing that we are telling the MibSPI to ignore the other chip select pins and only look at the one pin you're interested in.   In that case, you've now only got TG0 that you can use as a chip select;  so the MibSPI looks like one slave SPI.

    Charles Johnston said:

    3) We left the CS for unused TGs to the defaults set in HALCoGen which is the same value as the TG.  If a slave TG size is zero and assigned CS never goes low, does this interfere with the reception of non-zero sized TGs?

    This should also be taken care of by only enabling one chip select pin as functional.   There won't be any way to select any of the other TGs through the pins.

    Charles Johnston said:

    PS - We really appreciate your quick and accurate responses on this forum.  You seem to get assigned most of our questions, and we would be lost without your clarifications

     

    Thank you that's always nice to hear.  And thank you for choosing the TMS570 product line when there are so many MCU choices available.

  • Thanks, Anthony.

    It makes sense now.

    Charlie Johnston

  • hello,i am from China。i am glad to to ask for ur help.i have two RM48952 boards with MIBspi5 connected  with wire. the one is as master,and the other is slave..i use halcogen to generate code. the only palce i alter is enable mibspi5

    do u have example that two board communication with mibspi5? please send me!  thank u!  zhouranvipo@sina.com

    list is my master and slave code

    //master

    void main(void)
    {
    /* USER CODE BEGIN (3) */
    uint16 tx[8] = {0xAAAA,0xAAAA,0xAAAA,0xAAAA,0xAAAA};
    uint16 rx[8] = {0};
    mibspiInit();

    mibspiSetData(mibspiREG5,0,tx);
    mibspiTransfer(mibspiREG5,0);


    while(mibspiIsTransferComplete(mibspiREG5,0) ==FALSE)
    {
    ;
    }

    mibspiGetData(mibspiREG5,0,rx);

    while(1);
    /* USER CODE END */
    }

    //slave

    void main(void)
    {
    /* USER CODE BEGIN (3) */
    uint16 tx[16] = {1,2,3,4,5,6,7};
    uint16 rx[16] = {0};

    mibspiInit();

    mibspiSetData(mibspiREG5,0,tx);
    mibspiTransfer(mibspiREG5,0);

    while(mibspiIsTransferComplete(mibspiREG5,0)==FALSE )// slave wait unitl data is coming!
    {
    ;
    }

    mibspiGetData(mibspiREG5,0,rx);

    while(1);
    /* USER CODE END */

    }

    thank u!!!!!!!!!!