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.

TMS570LS0914: Using SPI5 pins a GIO: Only some work

Part Number: TMS570LS0914
Other Parts Discussed in Thread: HALCOGEN, TMS570LC4357

Tool/software:

I have a PGE (144 pin) version of the chip if it matters.  SPI5 ENA appears on pin 97 (if you have the correct pin mux set).  But for me, pin 97 is not yet connected.  I wanted to ensure that I could use ENA as a GIO pin and could not make it work with HalCoGen.  So I wrote this bit of code:

            spiREG5->PC0 = 0;
            spiREG5->PC1 = 0xfff;
            spiREG5->PC3 = 0;
            printf("SPI5 after 0 to PC3: PC0: %x, PC1: %x, PC2: %x, PC3: %x\n",spiREG5->PC0,spiREG5->PC1,spiREG5->PC2,spiREG5->PC3);
            spiREG5->PC4 = 0xfff;
            printf("SPI5 after fff to PC4: PC0: %x, PC1: %x, PC2: %x, PC3: %x\n",spiREG5->PC0,spiREG5->PC1,spiREG5->PC2,spiREG5->PC3);
            printf("Single bits Ena and Clock: %d %d\n",gioGetBit(spiPORT5,8),gioGetBit(spiPORT5,9));
The result was:

SPI5 after 0 to PC3: PC0: 0, PC1: 1010f0f, PC2: 0, PC3: 0
SPI5 after fff to PC4: PC0: 0, PC1: 1010f0f, PC2: 1010e0f, PC3: 1010f0f
Single bits Ena and Clock: 0 1

In other words, PC0 is set for all SPI5 pins  to be GIO, PC1 was set for all pins from SCS0 to SOMI0 (and one unused) pin to be output.  Writing 1 to DOUT in fact sets all

the bits when I read DOUT back.  However, given that this is an in/out GIO, I would expect to get the same result back on DIN, and in fact I do for all the implemented SCS lines

and the clock line.  But not ENABLE.  Unfortunately, I need another GIO pin, and ENABLE is the one that is available on the package.  Why is it different from all the rest of the SPI pins?

  • Hi Burns,

    Apologies for the delay response.

    First i am suggesting you to refer below thread once:

    (+) [FAQ] TMS570LC4357: How to use different peripherals pins (like Lin, MibSPI, N2HET, ECLK and RTP) as GIO - Arm-based microcontrollers forum - Arm-based microcontrollers - TI E2E support forums

    Here i mentioned procedure on how to use different peripheral pins as GIO with example code.

    Here you can refer MibSPI to GIO once:

    If this doesn't solve your problem, then i will create a example at my end for SPIENA as GIO.

    --
    Thanks & regards.
    Jagadish.

  • Hi Jagadish,

    In my original question, I showed a test that I made with the actual TMS570 registers (in case HalCoGen had some bugs (which I have seen before).  But in fact I was using HalCoGen for my actual code.  The only difference I see between what I did and what your examples show:

    1) I don't use the pullup resistors.

    2) I checked SPI rather than MIBSPI drivers

    3) I was using SPI5 SPIENA rather than SPI3 CLK etc.

    Note that as I said above, the pin for SPI5 SPIENA is not connected on my prototype board, but that is true for SPICLK as well.  I expect that having set the GIO output high, that I would also read it back as high as well.  

    Perhaps an example would be good.  Thanks.

  • Hi Burns,

    Apologies for the delayed response!

    I was off for few days and didn't get time to work on your issue.

    Note that as I said above, the pin for SPI5 SPIENA is not connected on my prototype board, but that is true for SPICLK as well.  I expect that having set the GIO output high, that I would also read it back as high as well.  

    I don't understand your concerns, you are saying SPIENA is not routed in your prototype board and then how do you want to verify your output. What is the purpose of configuring this pin as output?

    --
    Thanks & regards,
    Jagadish.

  • Hi,

    I was trying to determine whether I could use SPI5 SPIENA as a GPIO for the next spin of the board.  I was verifying it by setting the GPIO and then reading it back.   If I look at the DOUT register, I can see that I correctly set the bit.  However, on the DIN register, it shows not set.  While I understand that the pin is floating, it should be driven high since it is an output, and thus I expect to read it on both DOUT and DIN.  As I said, this was confirmed by the SCS lines.

    Thanks.

  • Hi Burns,

    I don't have exact your board to provide direct code, however i did your requirement on my TMS570LC4357 Launchpad and here it worked fine for me. The SPI IP should be same on these boards so if you follow same as my code and configurations then it should work on your end too.

    Here is the code:

    SPI5ENA_AS_GIO_OUTPUT_LC4357.zip

    Here is the output step by step:

    --
    Thanks & regards,
    Jagadish.