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.

HALCoGen 04.01.00 SPI bug with TMS570LS20216

Other Parts Discussed in Thread: HALCOGEN

I believe the HALCoGen 04.01.00 SPI driver generated for the TMS570LS20x family contains a bug in the spiGetData() function.  If transfer group number is 7, when the end variable value is calculated, the LTGPEND register is being masked with 0x0000EF00.  The mask should be 0x00007F00.

The following snippet shows the variable value calculation with the problem highlighted.  Could you recommend a way to proceed given this error?

spiRAM_t *ram    = spi == spiREG1 ? spiRAM1 : (spi == spiREG3 ? spiRAM3 : spiRAM5);
uint32 start  = (spi->TGCTRL[group] >> 8U) & 0xFFU;
uint32 end    = group == 7U ? (((spi->LTGPEND & 0x0000EF00U) >> 8U) + 1U) : ((spi->TGCTRL[group+1U] >> 8U) & 0xFFU);
uint32  flags  = 0U;

  • Thanks for identifying this issue. It is reported to the HALCoGen team and will be addressed soon.

    For the time being, you can modify this routine as follows:

    /* USER CODE BEGIN (8) */

    #if 0

    /* USER CODE END */

    ...

    spiRAM_t *ram    = spi == spiREG1 ? spiRAM1 : (spi == spiREG3 ? spiRAM3 : spiRAM5);

    uint32 start  = (spi->TGCTRL[group] >> 8U) & 0xFFU;

    uint32 end    = group == 7U ? (((spi->LTGPEND & 0x0000EF00U) >> 8U) + 1U) : ((spi->TGCTRL[group+1U] >> 8U) & 0xFFU);

    uint32  flags  = 0U;

    ...

    /* USER CODE BEGIN (9) */

    #endif

    ...

    spiRAM_t *ram    = spi == spiREG1 ? spiRAM1 : (spi == spiREG3 ? spiRAM3 : spiRAM5);

    uint32 start  = (spi->TGCTRL[group] >> 8U) & 0xFFU;

    uint32 end    = group == 7U ? (((spi->LTGPEND & 0x00007F00U) >> 8U) + 1U) : ((spi->TGCTRL[group+1U] >> 8U) & 0xFFU);

    uint32  flags  = 0U;

    ...

    /* USER CODE END */

    Basically, you are replacing the body of the function by using the #if 0 ... #endif construct. This way, you will not lose the changes even if you generate your code again using HALCoGen.

    Regards, Sunil

  • Hi

    I see this fixed in the Internal HALCoGen Drop, Fix should be rolled out in the upcoming 4.02.00 release.