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.

TMS570 SPI1 Alternate pins not working

Other Parts Discussed in Thread: HALCOGEN

Our hardware engineers have tracked a parallel to serial chip to pins 105 & 106 of the TMS570LS3137PGE. These are labelled mibspi1SOMI[1] & mibspi1SIMO[1], which I'm assuming are the alternate output pins. We already have a device on the standard pins. The SPI is being run in compatibility mode.

Firstly, am I right in saying that switching to the alternate pins cannot be done 'on the fly'?

Secondly, I have tried to reconfigure for the alternate pins and I'm not having much success.

The HalCoGen generated initialisation looks like this:


    /* SPI1 set all pins to functional */
    spiREG1->PC0  =   (uint32)((uint32)0U << 0U)  /* SCS[0] */
                    | (uint32)((uint32)0U << 1U)  /* SCS[1] */
                    | (uint32)((uint32)0U << 2U)  /* SCS[2] */
                    | (uint32)((uint32)0U << 3U)  /* SCS[3] */
                    | (uint32)((uint32)0U << 4U)  /* SCS[4] */
                    | (uint32)((uint32)0U << 5U)  /* SCS[5] */
                    | (uint32)((uint32)0U << 8U)  /* ENA */
                    | (uint32)((uint32)1U << 9U)  /* CLK */
                    | (uint32)((uint32)0U << 10U)  /* SIMO[0] */
                    | (uint32)((uint32)0U << 11U)  /* SOMI[0] */
                    | (uint32)((uint32)1U << 17U)  /* SIMO[1] */
                    | (uint32)((uint32)1U << 25U); /* SOMI[1] */

The pinmux has been changed to have 105 connected to MIBSPI1SOMI_1. The SIMO pin isn't needed because it is a read only device.

The read function looks like this:

uint32 SPI_Rx_Data(spiBASE_t *spi, spiDAT1_t *dataconfig_t, uint32 blocksize, U8 * destbuff, U8 remain_selected_u8)
{
    U32 Chip_Select_Hold = 0U;
    U32 data_hold_u32;
/*SAFETYMCUSW 28 D MR:NA <APPROVED> " loop to send data continuously" */
    do
    {
        if(!(spi->FLG & 0x000000FFU))
        {
            if(blocksize < 2U)
            {
                if( !remain_selected_u8 )
                {
                    Chip_Select_Hold = 0U;
                }
            }
            else
            {
                Chip_Select_Hold = (uint32)dataconfig_t->CS_HOLD << 28U;
            }
            /*SAFETYMCUSW 51 S MR:12.3 <APPROVED> "Needs shifting for 32-bit value" */
            spi->DAT1 = ((uint32)(dataconfig_t->DFSEL)   << 24U) |
                        ((uint32)(dataconfig_t->CSNR)    << 16U) |
                        ((uint32)(dataconfig_t->WDEL)    << 26U) |
                        (Chip_Select_Hold)                       |
                        (0x00000000U);
            /*SAFETYMCUSW 28 D MR:NA <APPROVED> "Hardware status bit read check" */
            while((spi->FLG & 0x00000100U) != 0x00000100U)
            {
            } /* Wait */
            /*SAFETYMCUSW 45 D MR:21.1 <APPROVED> "Valid non NULL input parameters are only allowed in this driver" */
            data_hold_u32 = spi->BUF;
            *destbuff = (U8)data_hold_u32;
            destbuff++;
        }
        blocksize--;
    }while(blocksize > 0U);

    return (spi->FLG & 0xFFU);
}

This function gets stuck at the 'while' loop; waiting for the RxInt flag to be set.

The device on the standard output pins works fine (when the pinmux is configured for it).

Any idea what could be going wrong?

Regards

Andy