Skip to main content
NBula.1
Associate III
February 17, 2021
Solved

SPC570S GPIO Setup

  • February 17, 2021
  • 4 replies
  • 2209 views

HI,

I have a question regarding the GPIO setup.

I have setup a few pins and outputs from the pin map editor. For all of those pins, the toggle

function work without any issue. However when I try to turn them on or off using the write_pad function or the set_pad, clear_pad function it does not work.

Nisal

    This topic has been closed for replies.
    Best answer by zambrano.luigi

    Hi,

    I guess that you have configured the pin PE11 (GPIO75) because it is connected with the LED D13. So, I think the aim of the test is to see the LED D13 blinking. Let me underline that the behavior of the function pal_lld_writepad is exactly what expected. The first istruction in the cycle

    pal_lld_writepad(PORT_E, PIN_GPIO75, PAL_HIGH);

    will switch-off the LED D13, while the second instruction

    pal_lld_writepad(PORT_E, PIN_GPIO75, PAL_LOW);

    will switch-on the LED13.

    If you want to see the LED D13 blinking, you have to add also a delay between the switch on and the switch off. So, you have to modify the cycle as below:

    for (;;) {

    osalThreadDelayMilliseconds(500);

    pal_lld_writepad(PORT_E, PIN_GPIO75, PAL_HIGH);

    osalThreadDelayMilliseconds(500);

    pal_lld_writepad(PORT_E, PIN_GPIO75, PAL_LOW);

    }

    Moreover, please, remember to close the jumper JP14 that connect the LED D13 to the power.

    Regards,

    Luigi

    4 replies

    zambrano.luigi
    ST Employee
    February 19, 2021

    Hi,

    please, could you share an example of code and clarify the expected behavior?

    Regards,

    Luigi

    NBula.1
    NBula.1Author
    Associate III
    February 19, 2021

    Hi Luigi,

    Attached here with is the project.

    Nisal

    zambrano.luigi
    zambrano.luigiBest answer
    ST Employee
    February 22, 2021

    Hi,

    I guess that you have configured the pin PE11 (GPIO75) because it is connected with the LED D13. So, I think the aim of the test is to see the LED D13 blinking. Let me underline that the behavior of the function pal_lld_writepad is exactly what expected. The first istruction in the cycle

    pal_lld_writepad(PORT_E, PIN_GPIO75, PAL_HIGH);

    will switch-off the LED D13, while the second instruction

    pal_lld_writepad(PORT_E, PIN_GPIO75, PAL_LOW);

    will switch-on the LED13.

    If you want to see the LED D13 blinking, you have to add also a delay between the switch on and the switch off. So, you have to modify the cycle as below:

    for (;;) {

    osalThreadDelayMilliseconds(500);

    pal_lld_writepad(PORT_E, PIN_GPIO75, PAL_HIGH);

    osalThreadDelayMilliseconds(500);

    pal_lld_writepad(PORT_E, PIN_GPIO75, PAL_LOW);

    }

    Moreover, please, remember to close the jumper JP14 that connect the LED D13 to the power.

    Regards,

    Luigi

    NBula.1
    NBula.1Author
    Associate III
    February 24, 2021

    HI Luigi,

    I am extremely sorry, I missed that part. It is working fine now. Thank you for your help.

    I have another question regarding using unions in SPC5. Does the SPC5 micro controllers follow big endian format or

    little endian format?

    Nisal

    zambrano.luigi
    ST Employee
    February 24, 2021

    Hi Nisal,

    the SPC5 micros are big endian.

    Regards,

    Luigi

    PSeka.1
    Associate II
    January 29, 2022

    Hi Luigi,

    i m working on SPC560CL3 MCU. Is it possible to change big endian to little endian?

    thanks and regards

    prabu.s