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.

RM48x SPI Pin Control (SPIPC0)

Other Parts Discussed in Thread: HALCOGEN

Hi All,

Beginner here, I need some help in understanding the SPIPC0 register. In Halcogen, setting this particular register is different when in standard SPI and MibSPI. In MibSPI, all SCS[4:0] can be set to SPI or GIO while for the standard  SPI only the SCS[0]. Why there is a difference? In standard mode if I set SPIPC0[7:0] to 1 already means all SCS pins are enbled?

regards,

Chris

  • Hi Chris,

    There is no difference in Hardware use perspective, SPI1 is compatibility mode of MIBSPI1 where in HALCoGen driver implementation is restricted to One CS. Hence the GUI also reflects the same. Same thing applies to SPI3 and SPI5 which are compatibility modes of MIBSPI3 and MIBSPI5.

    If you want to use MIBSPI CS pins as GIO, please configure them using MIBSPI Module and call mibspiInit function.

    Please let me know if you want to use SPI1 CS1 to 4 in compatibility mode, you can use the Usercode section at the end of spiInit..

    Below is a SPI1 configuration you can use if all CS 0 to 4 are configured as functional pins

    -----------------------------------------------------
    /* USER CODE BEGIN (3) */


        /** - SPI1 Port output values */
        spiREG1->PC3 |=  ( 1U << 0        /* SCS[0] */
                       |1U << 1        /* SCS[1] */
                       |1U << 2        /* SCS[2] */
                       |1U << 3        /* SCS[3] */
                       |1U << 4        /* SCS[4] */
           );

        /** - SPI1 Port direction */
        spiREG1->PC1 |=  ( 1U << 0        /* SCS[0] */
                       |1U << 1        /* SCS[1] */
                       |1U << 2        /* SCS[2] */
                       |1U << 3        /* SCS[3] */
                       |1U << 4        /* SCS[4] */
           );

        /** - SPI1 Port open drain enable */
        spiREG1->PC6 |=  ( 0U << 0        /* SCS[0] */
                       |0U << 1        /* SCS[1] */
                       |0U << 2        /* SCS[2] */
                       |0U << 3        /* SCS[3] */
                       |0U << 4        /* SCS[4] */
           );

        /** - SPI1 Port pullup / pulldown selection */
        spiREG1->PC8 |=  ( 1U << 0        /* SCS[0] */
                       |1U << 1        /* SCS[1] */
                       |1U << 2        /* SCS[2] */
                       |1U << 3        /* SCS[3] */
                       |1U << 4        /* SCS[4] */
           );

        /** - SPI1 Port pullup / pulldown enable*/
        spiREG1->PC7 |=  ( 0U << 0        /* SCS[0] */
                       |0U << 1        /* SCS[1] */
                       |0U << 2        /* SCS[2] */
                       |0U << 3        /* SCS[3] */
                       |0U << 4        /* SCS[4] */
           );

        /* SPI1 set all pins to functional */
        spiREG1->PC0 |=  ( 1U << 0        /* SCS[0] */
                       |1U << 1        /* SCS[1] */
                       |1U << 2        /* SCS[2] */
                       |1U << 3        /* SCS[3] */
                       |1U << 4        /* SCS[4] */
           );

    /* USER CODE END */

    ----------------------------------------------------------

    Regards
    Prathap