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.

Use mibspi as io

Other Parts Discussed in Thread: HALCOGEN, TMS570LS0332

Hi,

I have a custom board using the TMS570LS0332, CCS6, Halcogen 4.1.

 

I have an LED that is connected to MIBSPI1nCS[1] that I want to blink and I'm having trouble.

In Halcogen, I have:

- Enabled the GIO and MIBSPI1 driver

- Enabled MIBSPI1 on the PINMUX tab (I am also using the mibspi to communicate with the TPS65381), should CS1 be connected or not?

- On the MIBSPI1 Port tab, set SCS[1] as GIO and set the direction as output.

 

Code snippet is below:

gioInit();
mibspiInit();
gioToggleBit(mibspiPORT1, (1 << 1);

 

But my LED doesn't blink.  Any idea what I am doing wrong or missing?

Thanks

 

 

  • Hi David,

    gioToggleBit() has hardcoded register names such as DIN, DCLR and DSET. See below.

    void gioToggleBit(gioPORT_t *port, uint32 bit)
    {
    /* USER CODE BEGIN (10) */
    /* USER CODE END */
    
        if ((port->DIN & (uint32)((uint32)1U << bit)) != 0U)
        {
            port->DCLR = (uint32)1U << bit;
        }
        else
        {
            port->DSET = (uint32)1U << bit;
        }
    }
    

    The MibSPI module header file declares the register names to match those used in the TRM, viz. PC0 through PC8, as the registers for controlling MibSPI I/Os. This is the reason that the gioToggleBit function is not working.

    You could create your own toggle function using the MibSPI register names.

    Regards, Sunil

  • Thanks.  I was able to get it working, but I am a little confused.  The led I am blinking is connected to the MIBSPI1nCS[1]..when I look in the TRM, it does not specify (at least that I can find) which bit is which for the PCX registers.  It just specifies bits 7-0 are SCSCLR[7-0]. 

     

    I guess I would have expected SCS[0] to be bit 0, but it appears that bit 0 controls SCS[1].

  • David,

    I verified that bit 0 does control SCS[0] and bit 1 controls SCS[1]. Can you confirm your observation from Wednesday?

    Regards, Sunil

  • Hi,

     

    There was an extra shift that I hadn't seen, so it was toggling the correct bit (1).

     

    Thanks