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.

Hercules RM48L952ZWT SPI2 and MIBSPI1 as GIO

Other Parts Discussed in Thread: RM48L952, HALCOGEN

Hello. We are using the Hercules RM48L952. If we selected to use SPI2 and MIBSPI1 for GIO, then are there additional steps to be able to toggle the ports as GIO outputs that was not required for other GIO repurposed components?  The reason is i.e., DMM all is needed to toggle as an output port was i.e.,

void DMM_DMMPC0_GPIO_OFF (uint32 bit)

{

dmmREG->PC0 = dmmREG->PC0 & (uint32)((uint32)0U << bit);

}

void DMM_DMMPC0_GPIO_OFF (uint32 bit)

{

dmmREG->PC0 = dmmREG->PC0 & (uint32)((uint32)0U << bit);

}

But for i.e., SPI2 (MIBSPI1), the same process for does not change the value of the SPI port repurposed as GIO. i.e.,

void SPI_GPIO_OFF (uint32 bit)

{

spiREG2->PC2 = spiREG2->PC2 & (uint32)((uint32)0U << bit);

}

void SPI_GPIO_ON (uint32 bit)

{

spiREG2->PC2 = spiREG2->PC2 | (uint32)((uint32)1U << bit);

}

 

the value of spiREG2->PC2 (and mibspiREG1->PC2) bits cannot be set to "1" (remains fixed at zero after the spiREG2->PC2 = spiREG2->PC2 | (uint32)((uint32)1U << bit);

 

Thank you.



  • To use spi as gio, take a look at the TRM, specifically the registers SPIPC4 (will set output) and SPIPC5(will clear output).  




    to set
    spi->PC4 = (uint32_t)1U << bit;
    
    where spi is the spiBASE 
    
    and spi->PC5 = (uint32_t)1U << bit; 
    
    to clear
    

  • Hi Thank you. can spi->PC2 still be used to check the value to toggle output? i.e.,

    if ((spiREG2->PC2 & (uint32)((uint32)1U << bit)) != 0U)
    {
    spiREG2->PC5 = (uint32_t)1U << bit; //clear
    }
    else
    {
    spiREG2->PC4 = (uint32_t)1U << bit; //set
    }

    This now worked for mibspi1 (i.e., mibspiREG1->PC5 = ...) so great thank you.  But not for spi2 (i.e., spiREG2->PC5 = ...)  Thank you again

  • Yes, that is exactly how I have my toggle function.

    It should work exactly the same for spi 2. I'd double check your halcogen configurations to make sure the pins you want are set as gio and output. Also, I don't know if when you use mibspi if there is a separate init function to call, but make sure you are calling spiInit() and that the spi pins are set up correctly on the pin mux tab if necessary.

  • Hi Thank you. Yes, we configured it in HalCoGen in SPI2 tab (it was as straightforward as the others), and verified in debugger spiInit function is executed. Could there be something else configured blocking us from controlling SPI2 as GIO? The default HalCoGen had SPI active because the SDCard port was over SPI2 in the TI installation. The hardware engineers told me they moved the SDCard port to MIBSPI3 and SPI2 was now available as GIO. Is it possible something is still configured in HalCoGen with the old set up? Or for SPI2 to work as GIO, after they removed the contact to the SDCard slave processor, that something else needs to be done so we can use it as GIO? Thank you again.

  • As far as I know all you have to do is:

    In Halcogen:
    Enable spi 2 driver on the Driver Enable tab
    (if necessary) select the appropriate pins in the pinmux tab (I don't know the RM series)
    Under SPI2 tab, set the appropriate ports are gio and output.

    That should be it. Can you put a scope probe on the line? You can change the initial value in Halcogen from 0 to 1, and then after the call to spiInit() you should see the line high. Then go back and set it to 0, and after the call to spiInit() it should be low.

    Otherwise there could be a hardware issue.
  • Thanks David for the help.

    Tammy Noergaard,

    Do you still see the problem ? If yes then pls send across the project so that I can have a quick look at it. Thanks.
  • Hi Karthik. SPI2 works perfectfally now as GIO. But the problem now is the hardware team moved the SDCard from SPI2 to MIBSPI3 on Hercules board. I configured HalCoGen to match the old SPI2 settings, but there are more options for MIBSPI3 then regular SPI. Do you know what the minimum required for SDCard that used to be on SPI2 is to work on MIBSPI3? Do you still want me to send you our test project?
  • Even though it is on MIBSPI3, can you run it in compatibility mode (so select SPI3 on the driver enable tab, not MIBSPI3) and then configure it using the settings that had been used on SPI 2 on the SPI 3 tab?

     

    Make sure to select MIBSPI3 on the pinmux tab if needed.

  • Hi Thank you. The hardware guys wanted to add a 2nd slave device with SDCard on the MIBSPI3 bus. Will this work even with MIBSPI in SPI3 compatibility mode with both?
  • I don't see why not. If they are both spi devices and have chip selects, then you just use them like regular spi devices, enabling the chip select for the device you want to communicate with when you do a transmission.
  • Yes, that should work the same when configured in compatibility mode.
  • Hi Thank you. Is there something special that needs to be done for MIBSPI3 to work as an SPI3 in compatibility mode?   See 3 attached screen shots and below of the oscilloscope, and the schematics of SDCard connected to SPI2 and then conntected to MIBSPI3/SPI3. Is there something wrong with the hardware and it has to be changed when connecting SDCARD to MIBSPI2/SPI3 vs SPI 2?  In attachment you can see the V5_MIBSPI3_nCS1 never pulled low.   you can see the signals for V5_MIBSPI3_nCS1 (ch2 blue color) and V9_MIBSPI3_CLK (ch1 yellow color).  V5_MIBSPI3_nCS1 is Active Low so it needs to pull low when interfacing with SD card.  However, it just stays high the whole time.  The clock frequency for V9_MIBSPI3_CLK looks funny  but it is the same as default from TI for SPI2/SDCard I.e., Data Format 0 Baud Rate 550 KHz, ...). Thankyou again.

    MIBSPI3/SPI3

    SPI2

  • Hi,

    On looking on to your schematic I have a quick question for you.

    on the HDK schematics SPI2CS0 connected to D3-CD in SPI-2

    but you are using  MIBSPI3nCS1 connected to D3-CD in SPI-3

    Any reason for not using MIBSPI3nCS0 ?

  • Hi. The hardware engineers were planning to use MIBSPI3nCS0 for another component (wireless transceiver device). But it has not been added yet. First we were trying just to move the SDCard from SPI2 to SPI3. Is it a problem that there is no hardware yet on MIBSPI3nCS0, and we are trying to use MIBSPI3nCS1 for SDCard?
  • No, but have you taken care in your software from moving from SPI2 to SPI3 on choosing the right CS ?
  • Thank you. We have done that with our OS vendor now. I have contacted Micrium now about their BSP. Thank you again.