TrueSTUDIO 9.0.1 Flash and run without debugging

  1. go to Run > External Tools > External Tools Configurations
  2. right-click on Program > click New
  3. set Location and Working directory to ST-LINK_CLI.exe
  4. for ST-LINK / ST-LINK v2, set Arguments to:
    -c SWD -P ${project_loc}\${config_name:${project_name}}\${project_name}.hex -Rst
    or with flash erase (-ME) and veryfy (-V), which is slower:
    -c SWD -ME -P ${project_loc}\${config_name:${project_name}}\${project_name}.hex -V -Rst
    for ST-LINK v2 with connect under reset (UR):
    -c SWD UR -P ${project_loc}\${config_name:${project_name}}\${project_name}.hex -Rst
    or with flash erase:
    -c SWD UR -ME -P ${project_loc}\${config_name:${project_name}}\${project_name}.hex -V -Rst

After configuration is done, Flash and run already may be used from Run > External Tools.

Next, open Run > Run Configurations…, right-click on Launch Group, click New..
Click “Add…” on the right side and choose external tool you’ve just created for ST-LINK_CLI.EXE:

Build-and-run may be done this way:
Press Ctrl+B to build your project, and then press Ctrl+F11 to flash and run.

 

TrueSTUDIO 9.0.1 + STM32CubeMX + PCM5102 I2S DAC example

Download stm32 + pcm5102 example source code here (937kb)

Just made a quick test to connect PCM5102 module to STM32F407VET6 board through I2S interface.

First, I downloaded and installed latest version of CubeMX. I changed default position of I2S pins as shown on the image below:

First, audioBuffer array is filled with two sinusoidal tones of 1KHz and 2KHz. Then HAL_I2S_Transmit_DMA is called to run DMA transfer in circular mode.

Although I2S configured as 32/32bit tranfer, I configured DMA transfer as halfword/halfword (16bit) to make it work correctly. It seems that there is a hint in STM’s Reference Manual:

The 24-bit and 32-bit data frames need two CPU read or write operations to/from the SPI_DR or two DMA operations if the DMA is preferred for the application. For 24-bit data frame specifically, the 8 nonsignificant bits are extended to 32 bits with 0-bits (by hardware)