cancel
Showing results for 
Search instead for 
Did you mean: 

Need Help with SPC5 Studio for Basic LED Blinking Program

Ali5
Associate III

Hello all,

I'm Ali, new to ST Microcontrollers, and I'm seeking some guidance to get started with SPC5 Studio. Previously, I developed custom SDKs where I had control over registers, their addresses, and more. However, transitioning to SPC5 Studio has proven challenging for me.

While I can easily import samples from the application library and run them on my microcontroller, I'm struggling with writing a simple LED blinking program. Understanding the schematic, identifying pins, ports, and other details has been particularly difficult.

Currently, I've created a project and set pin 1 as GPIO using pinMap editor, but I'm unsure how to proceed further. If anyone could provide assistance in getting started with SPC5 Studio, including basic programming instructions, it would be greatly appreciated.

For reference, I'm using the AEK-MCU-C1MLT1 board.

Best regards,
Ali

1 ACCEPTED SOLUTION

Accepted Solutions

Hi Ali,

Let us start with AutoDevKit Studio.

You do not need to install on SPC5Studio as it was before. Just download it and run the .exe to install it:

www.st.com/autodevkitsw

Eventually, you can also deinstall SPC5Studio.

After installation of AutoDevKit Studio 2.2.1, you need to update some components.

Just go in menu Help>Install new software and write the sever address:

autodevkit.spc5studio.com

MaxVIZZINI_0-1711993265518.png

Select all and proceed with the installation. Once completed it will ask you to restart AutoDevKit Studio.

After the installation if you click on the 'already installed' link shown in cyan in the previous image you should see the latest installation AutoDevKit group feature version 2.3.1

MaxVIZZINI_1-1711993403890.png

Now considering the MCU board you have the key low-level drivers primitives you need are:

/* Turn off the first led of the MCU board .*/
pal_lld_setpad(x,y);

/* Delay execution for given milliseconds*/

osalThreadDelayMilliseconds(number_of_millisenconds);

 /* Turn on the first led of the MCU board .*/
pal_lld_clearpad(x,y));

/* Delay execution for given milliseconds*/

osalThreadDelayMilliseconds(number_of_millisenconds);

The pin configuration for a given example is:

MaxVIZZINI_5-1711996346239.png

These 4 functions in an infinite loop will toggle the LED of the board continuously.

An alternative example code to toggle three LEDs follows:

MaxVIZZINI_6-1711996467756.png

 

If you want to do it on button press, you should enable the WakeUP unit and set a callback to be invoked every time the button is pressed.

A configuration example below:

MaxVIZZINI_2-1711995612871.png

Then in the code you need to define the callback function outside the main function, called SetAutomaticOrManualMode() in the above case, and in the main code you should initialize the wakeup unit with the following command:

 

MaxVIZZINI_3-1711995758121.png

The second parameter is the name of the configuration you have chosen.

The Interrupt pin in the example above is configured with:

MaxVIZZINI_4-1711995986211.png

Finally, regarding the LED example in the tutorial video, it involves the AEK-LED-21DISM1 board, a proper LED string driver board.

Best Regards,

AutoDevKit Team

 

View solution in original post

4 REPLIES 4
Max VIZZINI
ST Employee

Hi,

Try to have a look to intro videos from 2 to 7

https://www.youtube.com/watch?v=pQeyJQBHV1c&list=PLnMKNibPkDnEju3j_qhe-MFK-NnwD_kuP&index=2

 

Best Regards,

AutoDevKit Team

Ali5
Associate III

 

Hi,

Thank you for your response! I've already watched those videos, and while they are helpful, they seem to be using an LED driver that I'm unable to locate. Additionally, I'm having trouble finding the AutoDevKit they install on the SPC5 Studio.

Although the video content is quite informative, my primary goal is to write a simple application code where I can control GPIO to turn on the LED, similar to what we can do in Arduino or other platforms with code like:

cpp

 

pinMode(13, OUTPUT); // Pin 13 as digital LED out
pinMode(8, INPUT); // Switch input pin
bool disable = True;
void loop(){
 
if (digitalRead(8) == HIGH){ // On button press
digitalWrite(13, HIGH); // Turn LED on.
disable = False; // Do more processes
//Delay code
disable = True;
}

Your assistance is greatly appreciated.

Best regards, Ali

Hi Ali,

Let us start with AutoDevKit Studio.

You do not need to install on SPC5Studio as it was before. Just download it and run the .exe to install it:

www.st.com/autodevkitsw

Eventually, you can also deinstall SPC5Studio.

After installation of AutoDevKit Studio 2.2.1, you need to update some components.

Just go in menu Help>Install new software and write the sever address:

autodevkit.spc5studio.com

MaxVIZZINI_0-1711993265518.png

Select all and proceed with the installation. Once completed it will ask you to restart AutoDevKit Studio.

After the installation if you click on the 'already installed' link shown in cyan in the previous image you should see the latest installation AutoDevKit group feature version 2.3.1

MaxVIZZINI_1-1711993403890.png

Now considering the MCU board you have the key low-level drivers primitives you need are:

/* Turn off the first led of the MCU board .*/
pal_lld_setpad(x,y);

/* Delay execution for given milliseconds*/

osalThreadDelayMilliseconds(number_of_millisenconds);

 /* Turn on the first led of the MCU board .*/
pal_lld_clearpad(x,y));

/* Delay execution for given milliseconds*/

osalThreadDelayMilliseconds(number_of_millisenconds);

The pin configuration for a given example is:

MaxVIZZINI_5-1711996346239.png

These 4 functions in an infinite loop will toggle the LED of the board continuously.

An alternative example code to toggle three LEDs follows:

MaxVIZZINI_6-1711996467756.png

 

If you want to do it on button press, you should enable the WakeUP unit and set a callback to be invoked every time the button is pressed.

A configuration example below:

MaxVIZZINI_2-1711995612871.png

Then in the code you need to define the callback function outside the main function, called SetAutomaticOrManualMode() in the above case, and in the main code you should initialize the wakeup unit with the following command:

 

MaxVIZZINI_3-1711995758121.png

The second parameter is the name of the configuration you have chosen.

The Interrupt pin in the example above is configured with:

MaxVIZZINI_4-1711995986211.png

Finally, regarding the LED example in the tutorial video, it involves the AEK-LED-21DISM1 board, a proper LED string driver board.

Best Regards,

AutoDevKit Team

 

Ali5
Associate III

Hello Max,

Thank you for your detailed explanation and code examples. I really appreciate the effort you've put in to help me understand the process of configuring pins and controlling LEDs on this board.

After reviewing your instructions and the code, I followed the steps to configure pins 48, 53, and 55 as outputs using the "eMIOS_0U16 (eMIOS 0 channel 16)" option in the pin map editor. However, I'm still not seeing the LEDs blink when running the code. I've double-checked the board.h file, and the PORT numbers (PORT_E, PORT_A, and PORT_D) match the ones you provided.

If you don't mind, could you please review the attached screenshot of my pin configuration in the pin map editor? I want to ensure that I've set everything up correctly.

Additionally, if it's not too much trouble, I would greatly appreciate it if you could provide an example of how to configure a button input and the corresponding code for handling button press events. I understand that this might be considered a basic task for professionals like yourself, but as a newcomer to this field, your guidance is invaluable.

Thank you again for your patience and for taking the time to support learners like me. Your efforts are truly appreciated and will undoubtedly benefit not only me but also others who are starting their journey in embedded systems development.

Best regards,

Ali


Code_Screenshot.PNG

Pin_Configuration.PNG