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.

TMS570LS3137: MIBSPI communication for Active cell balancing

Part Number: TMS570LS3137
Other Parts Discussed in Thread: TMS570LS0714, , EM1402EVM, HALCOGEN

Hi,

I am doing active cell balancing in TMS570LS3137. the example code available is working on the evaluation board with SPI communication. Now, i want to implement it through MIBSPI not with SPI. 

while debugging, the code getting struck in the following:

g_ui32EMB1428Status = spiTransferByte(mibspiREG1, (EMB_COMMAND<<4));

if((g_ui32EMB1428Status &(0xF0)) != 0xA0)//done =high, enable=low
   {
   while (1);
   }

and  g_ui32EMB1428Status value is 0xD8. 

i am attaching my halcogen file with code. kindly review it and please let me know if any configuration setting, i am doing wrong.

4263.18-6-mibspi.zip

Thanks,

Regards,

Gargi Pancholi
  

  • Hello Gargi,

    In MibSPI mode, The multi-buffer RAM is used for holding transit and received data, control and status information. The TXRAM contains entries for transmit data which replicates the SPIDAT1 register. You can not use function written for spi in emb1428.c for MibSPI.

  • Thanks wang for the reply, 

    Active cell balancing algorithm is working fine with SPI protocol in TMS570LS3137. We have designed our TMS570ls0714 PCB Board. In that board, DAC setting is done by SPI protocol and Switch matrix balancing command is set by the MIBSPI. So First we are tring to implement active cell balacing in TMS570ls3137 with MIBSPI. But it is not working properly.

    So we have few questions related to mibspi protocol which are as follow:

    1) As per your answer we can not use this APi g_ui32EMB1428Status = spiTransferByte(mibspiREG1, (EMB_COMMAND<<4)); . Should we use   mibspiSetData(mibspiREG1, 0, &emb_cmd); this API  for checking cell balancing?

    2) As per Our schematics, SPI communcication is used for DAC setting and MIBSPI is used for sending balancing Command to switch matrix. DAC output is coming as per the current we set. But MIBSPI is not properly sending command for cell balancing. Can you please tell us setting for MIBSPI for TMS570ls0714 PCB Board?

    we are attaching our schematics for your reference.

    2604.ACB Schematics.pdf

    Thanks and regards,

    Gargi pancholi

  • Hi Gargi,

    You can use: spiSetData(spiREG1, 0, &emb_cmd);

    Please configure MibSPI1 as SPI compatibility mode which makes it behave exactly like a standard platform SPI module and ensures full compatibility with other SPIs.

  • Hi Wang,

    Thanks for your support.

    By spiSetData(spiREG1, 0, &emb_cmd); , do you mean to say that we can use this API in place of this.

    /* USER CODE BEGIN (2) */

     

    int EMB_COMMAND=0x05;

    uint16 emb_cmd;

     

    /* USER CODE END */

     

    int main(void)

    {

    /* USER CODE BEGIN (3) */

     

         emb_cmd = EMB_COMMAND<<4;

     

         gioInit();

        

             spiDAT1_t dataconfig1_t;

             dataconfig1_t.CS_HOLD = FALSE;

             dataconfig1_t.WDEL   = TRUE;

             dataconfig1_t.DFSEL   = SPI_FMT_0;

             dataconfig1_t.CSNR   = 0xFE;

     

             spiInit();

     

     

             while(1)

             {

                 SpiTransmitData (spiREG1, &dataconfig1_t, 16, &emb_cmd);

             }

         }

     

    If this is correct, I want to implement active cell balancing with this in TMS570LS3137.

    First of all, I have doubt in chip select.

    In example code, they are using GPIO4(CS_STORE) and GPIO7(CS_OE) as a chip select for sending balancing commands to EMB1428.

    Now, For that I am doing connection as follows using CS1 and CS2 for chip select.

    TMS570LS3137                      EM1402EVM

    SPI1SIMO                               GPIO3/MOSI_1

    SPI1SOMI                              GPIO4/MISO_1

    SPI1CLK                               GPIO2/SCLK_1

    CS1                                      GPIO1/CS_OE

    CS2                                      GPIO0/CS_STORE

    GND                                     GND

    GPIO6                                  GPIO5/RS_EMB1428

    GPIO1                                   FAULT_INT

    CS1 & CS2 functionality is SPI in HALCOGEN.

     

    Please verify and kindly let me know if any changes I have to made.

    Thanks and Regards,

    Gargi 

  • Hi Gargi,

    You can use SPI compatible mode for your application.

    Some slave devices require the chip select signal to be held continuously active during several consecutive data word transfers. Other slave devices require the chip select signal to be deactivated between consecutive data word transfers.

    Hercules MCU has a feature called CSHOLD. If the CSHOLD bit is set in the control field of a word, the chip select signal will not be deactivated until the next control field is loaded with new chip select information.

    So you can use CSHOLD feature instead of using GIO as SPI chip select.

    If you don't want to modify the example code, using GIO pin as chip select is also fine.