Posted on Leave a comment

STM32F429I-DISC1

Datasheet for stm32F429ZI https://www.st.com/en/microcontrollers-microprocessors/stm32f429zi.html

This board have a 2.4 Resistive touch TFT LCD. which uses the ILI9341  controller.

The touch screen which I got with this display is very bad. you have to press down on the screen before you power ON the device.

The microcontroller is based on the ARM CORTEX M4F which can be clocked up to 180MHz. This particular board has an 8Mbyte of SDRAM included which is basically useless with this screen. If you want to see the full potential you have to use the LTDC peripheral which when configured with DMA2D gives you a very powerful development board with multimedia capabilites.

Posted on Leave a comment

STM32F746IGT6 – An ARM CORTEX M7 Based Microcontroller

Datasheet

It’s an ARM Cortex M7 based microcontroller which has a maximum clock speed of 216Mhz.

Well, it has a few peripherals which when combined with its CPU, makes it a very powerful controller.

Those peripherals are LTDC, SDRAM Controller.

It also has the usual set of peripherals from the ST. But these in particular makes it a very powerful microcontroller.

Posted on Leave a comment

How to redirect printf() to USART in STM32f103RB using STM32Cube IDE

Printf() function can be redirected to USART and also towards SWO.

Here you will see how to redirect printf() to USART in STM32f103RB

You need to rewrite this code in your main.c file

/*
* Function Name: _write
* Function Description: Redirect the printf() statement towards the UART using the HAL_UART_Transmit
Author: Abhay

*/
int _write(int fd, char* ptr, int len) {
    HAL_UART_Transmit(&huart1, (uint8_t *) ptr, len, HAL_MAX_DELAY);
    return len;
}

If you have created your project using STM32CubeMX or STM32 Cube IDE, then you can rewrite it in between USER CODE BEGIN 0 as shown

/* Private user code ---------------------------------------------------------*/
/* USER CODE BEGIN 0 */
int _write(int fd, char* ptr, int len) {
    HAL_UART_Transmit(&huart1, (uint8_t *) ptr, len, HAL_MAX_DELAY);
    return len;
}
/* USER CODE END 0 */

/**
  * @brief  The application entry point.
  * @retval int
  */
int main(void)
{
  /* USER CODE BEGIN 1 */

  /* USER CODE END 1 */

  /* MCU Configuration--------------------------------------------------------*/

  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();

  /* USER CODE BEGIN Init */

  /* USER CODE END Init */

  /* Configure the system clock */
  SystemClock_Config();

  /* USER CODE BEGIN SysInit */

  /* USER CODE END SysInit */

  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  MX_USART1_UART_Init();
  /* USER CODE BEGIN 2 */
  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */

  while (1)
  {
    /* USER CODE END WHILE */

    /* USER CODE BEGIN 3 */

  }
  /* USER CODE END 3 */
}

After adding the code, connect the uart to your laptop or computer using serial to USB adapter and open serial Terminal application like YAT.
Then you will be able to see printf message over there.

Posted on Leave a comment

How to add a new .h header file in STM32 Cube IDE

  1. Click on [arrow] besides Core in your project explorer
  2. Right Click on “Inc” folder and point your mouse at the “NEW” menu item.
  3. Select “header file” option
  4. A new Header file dialog box will appear
  5. Fill in the name of the header file in “Header file” with a dot h extension
  6. Click on finish
  7. Now open your main.c file and add your custom header file after USER CODE BEGIN Incudes
Posted on Leave a comment

STM32L476vg ARM Cortex M4F Architecture

It uses ARM v7E-M architecture.

It a Harvard based architecture with two distinct buses for data and memory.

It has all the instruction set of M0, M1 and M3 .

It also has an additional feature set to support Floating-point Arithmetic. IEEE754 standard in single precision and double precision.

The following points are from the programming model.

There are three modes of operations:

  1. Thumb State
    1. Thread mode: Privileged
    2. Thread mode: Unprivileged
  2. Debug mode

Two thread mode are given to support a operating system. Kernel software run in priviledged mode and the user application software runs in unprivledged mode.

Unprivileged mode has some restriction on memory access.

Privileged mode has full access to system resources.

If an operating system is running and a user application needs to access the Privileged resources it has to generate an exception/interrupt and then the interrupt will be taken by the handler and put the system in privilege mode.

You can switch from privilege mode to unprivileged mode by setting nPRIV and SPSEL bit in the CONTROL register.

Just like all the other processors ARM Cotex M4 has registers and pointer registers.

The major difference is the use of two different stack pointer registers.

  1. Main Stack Pointer (MSP)
  2. Process Stack Pointer (PSP)

If application is running in privileged mode than main stack pointer will be used. And if the application is working in unprivileged the process stack pointer will be used.

General Purpose Registers:

R0 – R12 – General Purpose Register

R13 – Stack Pointer (SP) {MSP and PSP}

R14 – Link Register (LR)

R15 – program counter (PC)

Special registers:

  • xPSR – {APSR, EPSR, IPSR}
  • FAULTMASK
  • BASEPERI
  • PRIMASK
  • CONTROL
floating point registers of arm cortex m4f

There are 32 FPU registers from s0 to s31.

They group together to form a single 64-bit register. which are from D0 to D15

There is a Floating Point Status and Control Register (FPSCR).

Posted on Leave a comment

ARM Processor Based Microcontrollers from ST

There are lot of ARM based microcontroller offered by ST.

They use ARM Cortex M processor with ST peripheral such as GPIO, ADC etc.

They mostly fall into these following groups:

  1. ARM Cortex M0
  2. ARM Cortex M3
  3. ARM Cortex M4
  4. ARM Cortex M33
  5. ARM Cortex M7
    which is also known as M4F as it has an FPU unit.

Then there is ST classification :

  • High performance
    Higher clock speed, Has almost everything included from that segment.
  • Mainstream
    Balanced between Low Power and High Performance.
  • Low Power
    Clock speed reduced to a limit, Has additional hardware for switching off individual peripherals.
  • Wireless
    Has cortex M0+, Peripherals support for radio

The widely available stm32f1 microcontroller also known as the blue pill has ARM cortex M3.

STM32L4 has an ARM Cortex M4F.