Generate a PWM signal with GPIO.

ChibiOS public support forum for topics related to the STMicroelectronics SPC56x family of automotive micro-controllers.
GianlucaLaManna
Posts: 25
Joined: Fri Mar 13, 2015 12:12 pm
Location: Palermo, Italy

Generate a PWM signal with GPIO.

Postby GianlucaLaManna » Fri Mar 13, 2015 12:34 pm

Hello,
I'm a trainee to STMicroelectronics. We use the board SPC560P - DISP. How I can use the signal PWM with GPIO for (for example) to blink a led or to manage some servomotors? There is a full documentation? On site of ST there is a little information. There are the API?
I do not understand what port(GPIO) write and what should I use C functions.
I'm sorry, but I'm at the beginning.

Best regards
Gianluca.

User avatar
Giovanni
Site Admin
Posts: 11312
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 412 times
Been thanked: 342 times
Contact:

Re: Generate a PWM signal with GPIO.

Postby Giovanni » Fri Mar 13, 2015 12:49 pm

Hi,

Have you tried the PWM demo included in SPC5Studio? there is a an example there, the API documentation is accessible by right clicking on the "Portable HAL" component, then look under the "Doc" submenu.

Giovanni

GianlucaLaManna
Posts: 25
Joined: Fri Mar 13, 2015 12:12 pm
Location: Palermo, Italy

Re: Generate a PWM signal with GPIO.

Postby GianlucaLaManna » Fri Mar 13, 2015 1:01 pm

Yes I included this demo, but If I understand it that code writes PWM signals on the board for led D11. Ok I have found the doc. If I understand its operation I will close this thread.
Thank you very much.

Best regards
Gianluca.

GianlucaLaManna
Posts: 25
Joined: Fri Mar 13, 2015 12:12 pm
Location: Palermo, Italy

Re: Generate a PWM signal with GPIO.

Postby GianlucaLaManna » Fri Mar 13, 2015 3:52 pm

Ok I understand where it exits the signal PWM. I used the test program ICU PWM. Do you know how take external inputs? I've read that you must use eTimer.
For example, if I wanted to turn on and off a LED external to the board via a software interface like and what can I send as input to the board?
Thanks.

Best regards
Gianluca.

User avatar
Giovanni
Site Admin
Posts: 11312
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 412 times
Been thanked: 342 times
Contact:

Re: Generate a PWM signal with GPIO.

Postby Giovanni » Fri Mar 13, 2015 5:34 pm

What kind of external inputs? if you mean digital states on input pins then you have to use the PAL driver, palReadPad() reads the state of an input pin.

Giovanni

GianlucaLaManna
Posts: 25
Joined: Fri Mar 13, 2015 12:12 pm
Location: Palermo, Italy

Re: Generate a PWM signal with GPIO.

Postby GianlucaLaManna » Mon Mar 16, 2015 4:16 pm

Ok, I have to manage some sensors (ultrasonic sensor). I must then process the signal taken from the sensors to send to another output signal.
Input and output.
Thanks.

Best regards
Gianluca

GianlucaLaManna
Posts: 25
Joined: Fri Mar 13, 2015 12:12 pm
Location: Palermo, Italy

Re: Generate a PWM signal with GPIO.

Postby GianlucaLaManna » Tue Mar 17, 2015 4:39 pm

Sorry but I don't understand how to use the palReadPad(). Can I see a console for output? For example, I have a infrared sensor which provides output a number. Where can I see this number and which port and pad I have to use in the function palReadPad()? Which pin have to use on the board?
Sorry but I'm beginner.
Thanks.

Best regards
Gianluca.

User avatar
Giovanni
Site Admin
Posts: 11312
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 412 times
Been thanked: 342 times
Contact:

Re: Generate a PWM signal with GPIO.

Postby Giovanni » Tue Mar 17, 2015 4:43 pm

palReadPad() returns the status of an input pin which can be zero or one.

I cannot answer to any other question until you provide details about the sensor, how it is connected and how you expect to use it.

Giovanni


Return to “SPC56x Support”

Who is online

Users browsing this forum: No registered users and 1 guest