Skip to main content
NBula.1
Associate III
Feb 17, 2021 4:03 AM UTC
Solved

SPC570S GPIO Setup

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.
    zambrano.luigi
    zambrano.luigiBest answer
    ST Employee
    Feb 22, 2021 6:37 AM UTC

    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

    6 replies

    zambrano.luigi
    ST Employee
    Feb 19, 2021 12:17 PM UTC

    Hi,

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

    Regards,

    Luigi

    NBula.1
    NBula.1Author
    Associate III
    Feb 19, 2021 5:35 PM UTC

    Hi Luigi,

    Attached here with is the project.

    Nisal

    zambrano.luigi
    zambrano.luigiBest answer
    ST Employee
    Feb 22, 2021 6:37 AM UTC

    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
    Feb 24, 2021 7:54 AM UTC

    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
    Feb 24, 2021 8:42 AM UTC

    Hi Nisal,

    the SPC5 micros are big endian.

    Regards,

    Luigi

    PSeka.1
    Associate II
    Jan 29, 2022 12:40 AM UTC

    Hi Luigi,

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

    thanks and regards

    prabu.s