Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

STM32C0 Workshop Installation Guide and Code To Be Added V1.3 - In-PERSON

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 32

Installation Procedure (v1.

3)
Workshop: STM32C0: Your next generation 8-bit MCU is a 32-bit

Welcome to the STM32C0 Workshop!


Please follow all installation steps below before the day of the Workshop.

Workshop – Requirements

Important:

You need to have administration rights to be able to install drivers and software and to do the
workshop.

System requirements:

Windows® 10 and later or MacBook running Windows using Parallels, VM Fusion

Minimum Recommended Hardware Requirements:

 Micro USB Cable


 2+ GHz processor
 4 GB of system memory (RAM)
 7 GB of available disk space

Note: For machines with USB Type C, please bring a Type A to Type C adapter.

Makes sure the USB port you will use for the workshop is enabled.

1
STM32C0 Workshop - Installation Procedure – Introduction:

In the following installation procedure, you are going to install the following
Software/Tools/Libraries that are needed for the Workshop:

1. STM32CubeIDE: version 1.10.1 minimum required, if you have a previous version you
will need to install a new version as explained in this installation procedure.
o Page 4
2. STM32CubeC0: version 1.0.0 minimum required, if you have a previous version you will
need to install a new one as explained in this installation procedure.
o Page 12
3. STM32CubeProgrammer: version 2.10.0 minimum required, if you have a previous
version you will need to install a new version as explained in this installation procedure.
o Page 15

Code changes to use during the workshop:


4. Code to use during the workshop
o Page 25

Appendix A: STM32CubeC0 Firmware Library Offline installation


o Page 29

Notes:

1- Some of the versions of the software and libraries on our website might have
newer version than the version seen in the document, please use the latest version
from the links provided in the installation procedure below.
2- The look of our website is changing but the links provided in this document remain
the same.

The entire installation procedure can take several hours (downloading and installing).

2
Questions and support ahead of the workshop

1. If you have issues during the software download and install, please contact ST by
entering an Online Support Request at: https://community.st.com/s/onlinesupport?
o=ws&tabset-08cae=2
to help resolve the issue.

2. When entering the support request, in the Subject field please fill with:
“STM32C0: Your next generation 8-bit MCU is a 32-bit”

3. To ensure your request is quickly routed to the correct support team, please indicate the
Workshop Request Type, Technical or Non-Technical, that best describes your question.

3
STM32C0 Workshop - Installation Procedure

For the Workshop installation please follow the steps below:

1- STM32CubeIDE: STM32Cube initialization code generator

Click Link: STM32CubeIDE


Minimum version to be installed: 1.10.1
Or use Direct Install Link:
STM32CubeIDE - Integrated Development Environment for STM32 - STMicroelectronics

In the web browser, a similar page will come up:

4
Click on “Get Software” button:

Assuming you have a Windows-based machine click on “Get Latest” below:

When the following page appears:

Click on:

5
There are 3 ways of getting the software:

6
If you have an ST account, click on:

If you don’t have one, create one by clicking on:

If you don’t have an account and don’t want to create one, fill in the information below:

Click on the check box:

The software will automatically download in your browser.

If not click “Get Software”

Unzip the file (en.st-stm32cubeide_x.x.x_xxxx.zip) and you will see this:

7
Note: you may see a newer version in your case than the screenshot above.

Right Click on ‘st-stm32cubeide_x.x.x_yyy_x86_64.exe’ (x.x.x is the version number) and Run


as administrator:

Press “Next”:

8
Press “I agree”:

Press “Next”:

9
Press: “Install”

Wait for the install to complete and then press “Next”

10
Press “Finish”

11
2- STM32CubeC0: Install STM32Cube MCU Package for STM32C0 series

Double click on STM32CubeIDE icon or look for it in your Start Menu:

Click Launch:

Make your choice for the Usage Statistics Agreement:

12
Note: For those behind a corporate firewall or having issue with installing the Cube Library from
the internet, you can use “From local” to do an offline install of the STM32CubeC0 Library.

From STM32CubeIDE: Help -> Manage embedded software packages

Click on Refresh:

Under STM32C0, expand then check the latest STM32 MCU Package for STM32C0 and click
“Install”:

13
Agree on the terms of this license agreement, by selecting “I have read, and I agree to the the
terms of this license agreement” and then press Finish.

Once installed it should look like this and you can press “Close”

Note: In your system it might show a newer version depending on what latest version is
available
14
3 - STM32CubeProg: STM32CubeProgrammer software for programming
STM32 products

Click Link: STM32CubeProg


Minimum version required: 2.10.0
Direct Install Link:
https://www.st.com/content/st_com/en/products/development-tools/software-development-
tools/stm32-software-development-tools/stm32-programmers/stm32cubeprog.html

Click on:

Please get the latest software version available that will be accessible by clicking on:

15
Click on:

16
17
There are 3 ways of getting the software:

If you have an ST account click on:

If you don’t have one, create one by clicking on:

If you don’t have an account and don’t want to create one, fill in the information below:

Click on the check box:

Then click:
Save the file at a location of your choice:

Unzip the file (en.stm32cubeprog.zip)

Note: you may see a newer version in your case than the screenshot above.

18
Right Click on SetupSTM32CubeProgrammer-x.x.x.exe and Run as administrator

Add screen shot

Press Next:

19
Press Next:

Accept the Terms and then click on Next:

20
Important note: If you have a previous version, it will be overwritten if you keep the default path.
So, if you want to keep your previous version you will need to install the new version at a
different directory. But for the workshop make sure to use the correct version (version that we
are installing here).

Once you have decided on the path then press Next:

21
Press OK to create the Directory if the directory does not exist:

Follow those steps to install the ST-LINK Driver:


Press Next:

22
Press Finish:

Wait for the install to complete and then press Next:

23
Press Done:

Now try to open STM32CubeProgrammer to make sure it was installed properly.

24
4 – Code to be added during the workshop:

The code below are the changes we are going to do during the course of the workshop, and you
will be guided in step by step. This will help you so you do not have to retype everything since
you will be able simply to copy-paste.

STM32C0 Workshop Lab 1: Blinky


in main.c:

HAL_GPIO_TogglePin(LED_GPIO_Port, LED_Pin);
HAL_Delay(100);

STM32C0 Workshop Lab 2: PWM


in main.c:

HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_1);

STM32C0 Workshop Lab 3: EXTI


in main.c

uint8_t PC13_flag = 0;

//////////////////////

void HAL_GPIO_EXTI_Rising_Callback(uint16_t GPIO_Pin)


{
PC13_flag++;
if ( ( PC13_flag & 0x01 ) == 0x01 )
{
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_SET);
}
else
{
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_RESET);
}
}

25
STM32C0 Workshop Lab 4: Printf debugging using UART
in main.c:

/* USER CODE BEGIN PFP */


#define PUTCHAR_PROTOTYPE int __io_putchar(int ch)
/* USER CODE END PFP */

////////////////////////////

while (1)
{
printf("** Hello World ** \n\r");
HAL_Delay(1000);
/* USER CODE END WHILE */

/////////////////////////////

/* USER CODE BEGIN 4 */


PUTCHAR_PROTOTYPE
{
HAL_UART_Transmit(&huart2, (uint8_t *)&ch, 1, 0xFFFF);
return ch;
}
/* USER CODE END 4 */

STM32C0 Workshop Lab 5: LL Drivers


in main.c:

LL_GPIO_TogglePin(GPIOA, LL_GPIO_PIN_5);
// Delay 100 ms
LL_mDelay(100);

26
STM32C0 Workshop Lab 6: ADC + DMA + TIM
in main.c:

/* USER CODE BEGIN PV */


uint8_t buffer[8];

...

/* USER CODE BEGIN 2 */


HAL_ADCEx_Calibration_Start(&hadc1);
HAL_ADC_Start_DMA(&hadc1, (uint32_t *)buffer, 8);
HAL_TIM_Base_Start(&htim3);

STM32C0 Workshop Lab 7: RAM


in main.c:

/* USER CODE BEGIN 2 */


LL_USART_EnableIT_RXNE(USART2);
LL_USART_EnableIT_ERROR(USART2);

...

/* USER CODE BEGIN 4 */


void USART_CharReception_Callback(void)
{
uint8_t received_char;
received_char = LL_USART_ReceiveData8(USART2);
if ((received_char == 'E') || (received_char == 'e')) {
LL_GPIO_TogglePin(LED_GPIO_Port, LED_Pin);
}
LL_USART_TransmitData8(USART2, received_char);
}

27
in main.h:

/* USER CODE BEGIN EFP */


void USART_CharReception_Callback(void);
/* USER CODE END EFP */

in stm32c0xx_it.c:

/* USER CODE BEGIN USART2_IRQn 0 */


USART_CharReception_Callback();
/* USER CODE END USART2_IRQn 0 */

in STM32C031C6TX_FLASH.ld:

*/Drivers/*(.text*)
*main.o(.text.MX_GPIO_Init)
*main.o(.text.MX_USART2_UART_Init)
*main.o(.text.USART_CharReception_Callback)

28
Appendix A: STM32CubeC0 Firmware Library Offline Activation

Please follow the following steps

First open up STM32CubeIDE you have previously installed

Now select a Workspace, you can keep the default one and click Launch:

29
Now Go to Help -> Manage Embedded Software Packages

Now Clock on “From Local…”

30
Select “en.stm32cubec0-v1-0-0.zip” you have copied form the flash drive

Acknowledge the Agreement and then click Finish:

31
Now you should see the STM32CubeC0 Library installed properly with the green square as
seen below:

32

You might also like