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.

How to configure PORTB in TMS570LS1227

Other Parts Discussed in Thread: HALCOGEN, TMS570LS1227

Hi,

I’ve developed a PCB using the TMS570LS1227, and after several tries this microprocessor is running. To test my board I’ve created the following script (using CSS v6 and HalCoGen v4) to know if I’m capable of swithching on a LED connected to the PORTB[0], but nothing happens!

#include "gio.h"

void main(void)

{

    /* initialize gio     */

    gioInit();

    gioSetDirection(gioPORTB, 1);

                        /** -Delay Parameter */

                        int temp;

                        int delay;

                        delay = 0x200000;

    while(1) /* ... continue forever */

    {

    gioSetBit(gioPORTB, 0, 0); /* Set GIOB port pin 0 low */

                        for(temp=0;temp<delay;temp++); /** -Simple Delay */

                                               gioSetBit(gioPORTB, 0, 1); /* Set GIOB port pin 0 high */

                        for(temp=0;temp<delay;temp++); /** -Simple Delay */

                        }

}

/* GIO Notification function not used, but required by compiler */

voidgioNotification(intbit)

{

return;

}

Is there any option I should press before loading my script to the microP, or something similar??

Thanks a lot!

  • Hi David,

     At first glance, I don't see anything wrong with your code. Could you try to directly write a '1' to PORTB DOUT register in the debugger and see if the LED is turned on. You can also check the DIN register to see if it is set to '1' as well.

      I will also suggest that you try other GIO pins. If any other GIO pins turn on the LED but PORTB[0] then you might want to investigate the hardware connection on your board.

  • Hi,

    The DIn register is set to 0x00000000. I can't modify this in CCS.
  • Hi David,
    I mean to say that if you write to the DOUT register then the DIN register will reflect what you had written as well. So if you write to the DOUT register for PORTB[0] do you see the LED? Before you write to any GIO registers you must also release the GIO module from internal reset by setting the GIOGCR0.0 to high.
  • Hi David,
    I just created a simple project and I'm able to see GIOB[0] toggling at a rate of 2.6Hz using your code. You might want to check your board connection.
  • Hi Charles,

    Unfortunately, I'm not an expert in programming, please could you give me some clues to set GIOGCR0.0 at '1'? I tried to modify the register GlbCtrl to set a '1' in CCS, but it didn't change.

    Also, I modified the PORTB[0] in HALCoGen using different configurations to see if I was capable of modifying the value of DOUT (0 and 1 in different projects), nothing new happened. The most strange thing was that the value of the register in CCS didn't change even when I forced a '1' in DOUT (maybe this is because the RESET is still low). Also, I've seen that the register Srs is unable to read, I don't know if this's important!



    Regarding the hardware, there's electrical connectivity between the LED and the PORTB[0]. I've simplified my script to set a '1' in PORTB[0] to see always 3.3V.

    Thanks a lot!

  • Hi David,

      In HalCoGen there is a Driver Enable tab. Can you go to this tab and make sure that 'Enable GIO driver' checkbox is checked. See below. I have also included a working project to to toggle PORTB[0] that you can reference. 2728.LS1227_GIO.zip

  • Hi Charles,

    I checked my HALCoGen project and the GIO driver was enabled! Apart from this, I used your project to test my board, but I had the same result, nothing happens in PORTB[0].

    I also tried to do the same with NHET1[2] using the following script (this pin's directly droven to a connector), but I had the same result.

    #include "sys_common.h"
    #include"het.h"

    void main(void)
    {
    int temp,delay;
    /** -Delay Parameter */
    delay = 0x200000;
    /* Set HET port pins to output */
    gioSetDirection(hetPORT1, 0xFFFFFFFF);
    while(1)
    {
    /* Set HET port pin 1 high */
    gioSetBit(hetPORT1, 2, 1);
    /** -Simple Delay */
    for(temp=0;temp<delay;temp++);
    /* Set HET port pin 1 low */
    gioSetBit(hetPORT1, 2, 0);
    /** -Simple Delay */
    for(temp=0;temp<delay;temp++);
    }
    }

    /* GIO Notification function not used, but required by compiler */
    voidgioNotification(intbit)
    {
    return;
    }

    Regarding the hardware, I checked the different VCCIOs and VCCs to know if there was any problem with the power system, but they're powered at 3V3 and 1V2 repectively!

    I don't have more ideas!

    Thanks!

    David

  • HI David,

      Can you run my project or your project on the development board? Hopefully you have either a launchpad or a HDK board from TI. Just want to prove that it is not a software issue. If the software is good, then you can focus on the hardware aspect. 

      Do you have ECLK on your board? If yes, can you in CCS register window, do:

      1. Write 0x01 to the SYS module SysPc1 register.

      2. Write 0x00800007 to the SYS module EcpCntl register.

      If you have ECLK pin then you should see the internal VCLK divided 8 brought out to the pin? Do you see anything? Please also try this on your development board.

      One more thing I'd like you to check. Since you can't see NHET1[2] as an output on your board, what about input. Please configure NHET1[2] to an input pin and toggle the input high or low on this pin. Observe the Din register and do you see Din changes?

      You might want to check if there is any short in the board?

      

  • Hi Charles,

    I think I wasn't clear in my first post! I'm using a customized board (the design is mine). Maybe, there's an special configuration of the micro for third party developers. Thnks!

    David
  • Hi David,

      It is clear to me that you have your own customized board. There is no special configuration of the micro that will only work in the development board (i.e. LaunchPad or HDK) but not your board.

  • Hi Charles,

    I've checked the ECLK in both boards writing the values you gave me before. In my HDK the frequency of the ECLK signal is 11MHz and 320mV peak-to-peak, and in my board this's 1MHz and 5.5V peak-to-peak!

    David
  • Hi David,

     11MHz sounds about right on the HDK. It is more like 11.25MHz that I will expect. That will give 90MHz for VCLK since the ECLK is VCLK / 8. The HCLK will be 2 * VCLK = 180MHz. However, the p-p voltage of 320mV does not look right. The p-p swing should be at least 3.3V. Perhaps you didn't enable the ECLK pin for output. Attached please find the updated project. If you run this project you should see proper p-p on ECLK.

    0003.LS1227_GIO.zip

     Let's go back to your board. You measure 1MHz and 5.5V p-p. This also looks reasonable. Perhaps your are running off the OSC instead of PLL. I assume your OSC is 16MHz. After reset, OSC is the clock source for the HCLK so HCLK runs at 16MHz too. VCLK = HCLK / 2 and gives 8MHz. ECLK = VCLK / 8 and that gives 1 MHz. 5.5V p-p is reasonable if the overshoot and undershoot are taken for measurement. 

      Can you also load the new project I attached here to your custom board? Once the program is running can you take a screenshot of the Gio and GioB in the register window? The program has released the GIO from reset and the direction of GIOB[0] has been configured to output. I want to make sure the program has been properly loaded to your board. 

      The GIO module is memory mapped to 0xFFF7BC00. Follow the below steps to view the content of the GIO while the debugger is in run mode. 

      1. Go to the debug window, the window with a bug icon. Right click on your mouse and select 'show all cores'. You will see the IcePick and Dap devices.

      2. Open a memory browser window. Type in 0xFFF7BC00 as the starting address. The memory browser will show the content of the GIO.

      3. Go back to the debug window and select the Dap device.

      4. Go back to the memory browser window and at the upper right corner of the window select the pin to debug context icon.

      5. In the same memory browser window select the fourth icon from the right that says 'continuous refresh'

      6. Go back to the debug window and select CortexR4

      7. Run the device

      You should see the DOUT and DIN registers changing value at their respective addresses in the memory browser window.

      Perhaps you already know all the above. I just want to make sure that the program is running as intended in your custom board. If you still don't see any output on the LED then it is likely some sort of shorts exist in your board given the fact that the program is running in the HDK board for which you can observe the GIO toggling. 

  • It works!!

    Thanks a lot Charles!!

  • Hi David,

      Glad you problem is now resolved. 

  • Hi David,

      Do you mind to share what went wrong so that the community members may benefit in the future for similar problems?