Skip to main content

Enabling RTOS in STM32F407VET6

In STM32CubeIDE we can enable RTOS using following steps:

Configuration

1. In Pinout & Configuration, go to Middleware and Software Packs > FREERTOS

2. Configure Interface Mode as CMSIS_V1 or CMSIS_V2

3. Start adding OS Tasks, change Task name and Entry function.

    Example: 


 Manual Code

1. In main.c file > main() function instead of writing in while 1 loop, we need to write actual code in    Tasks generated. While 1 loop will not be reached as osKernelStart(); will take over.

2. LED Blinking code can be executed from TASK which we added

Example code:

/* USER CODE BEGIN Header_Task2_init */

/**

* @brief Function implementing the Task2 thread.

* @param argument: Not used

* @retval None

*/

/* USER CODE END Header_Task2_init */

void Task2_init(void const * argument)

{

/* USER CODE BEGIN Task2_init */

/* Infinite loop */

for(;;)

{

HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_6);

HAL_Delay(200);

    //osDelay(10);

}

/* USER CODE END Task2_init */

}

Comments

Popular posts from this blog

Connecting VSC with Raspberry Pi via SSH

 Steps to connect VSC to Raspberry Pi Running on Linux with SSH. 1. Follow steps mentioned in Putty blog to Enable SSH on Raspberry Pi. 2. Enable Extension " Remote - SSH" in VSC. 3. Go to view>Command Palette>Remote-SSH: Add new SSH host. 4. Enter ssh <username>@<Ip address> 5. Select config file with your user name. This will start setting up SSH Host. 6. It will prompt to enter password for your Raspberry Pi device. 7. After entering valid password SSH is established. 8. Now you can open folder from Raspberry Pi device. Which is your working Directory. 

Hello World on Ubantu Docker Image

 Steps to run simple C program on Ubantu Docker image: 1. Following files needs to be created in Working Directory folder.    hello.c    Dockerfile 2. hello.c file contains c program with  Hello, World! message printed out. 3. Dockerfile should contain below code          FROM ubuntu:latest            RUN apt-get update && apt-get install -y gcc            COPY hello.c /app/hello.c            WORKDIR /app            RUN gcc -o hello hello.c            CMD ["./hello"] 4. Build docker image using command " docker build -t my-hello-app ." 5. Once docker image is built, run the docker container using command "docker run my-hello-app" 6. Hello, World! will be printed out.

Connecting Raspberry Pi via Putty

 Steps to connect your Raspberry pi (Running with Linux) to Putty (Running on Windows 11): 1. Install ssh on Raspberry Pi Linux using command      sudo apt install openssh-server 2. Enable Ssh Service      sudo service ssh start 3. Make it always Enabled on Bootup    sudo systemctl enable ssh 4. Read Ip address of Raspberry Pi 5. Open Putty Tool on Windows Machine, Enter Ip address and connect 6. It will open Window like shown below, Login with credentials and password. 7. You are ready to control Raspberry Pi Linux with Putty tool.