Weact STM32H743VIT6 Mini board

ag123
Posts: 1798
Joined: Thu Dec 19, 2019 5:30 am
Answers: 28

Weact STM32H743VIT6 Mini board

Post by ag123 »

Just ordered one of this
https://www.aliexpress.com/item/1005001700815862.html
docs are here
https://github.com/WeActTC/MiniSTM32H7xx
I've no idea what I'm going to do about the board, it is too powerful as a 'microcontroller' and cramp packed with hardware it'd be a wonder if most of them would be used, but yet it doesn't have a mmu so it don't run linux :lol:
Last edited by ag123 on Tue Nov 23, 2021 10:50 pm, edited 1 time in total.
ag123
Posts: 1798
Joined: Thu Dec 19, 2019 5:30 am
Answers: 28

Re: STM32H743VIT6

Post by ag123 »

maybe as an over powered web cam :lol:
mrburnette
Posts: 633
Joined: Thu Dec 19, 2019 1:23 am
Answers: 7

Re: STM32H743VIT6

Post by mrburnette »

AliExpress.jpg
AliExpress.jpg (25.39 KiB) Viewed 13916 times
I'm more of a Teensy 4.1 kind of guy in the Arduino playground at that price point. But, nice board.

Teensy 4.JPG
Teensy 4.JPG (31.29 KiB) Viewed 13916 times
ag123
Posts: 1798
Joined: Thu Dec 19, 2019 5:30 am
Answers: 28

Re: STM32H743VIT6

Post by ag123 »

What do you do with a 1027 DMIPS STM32H743VI microcontroller board with 2 MB flash and 1 MB sram.
Well blink a led

https://youtu.be/DwuuQgHjDtU

The vendor made a much better 'sketch' at least shows something on the LCD, i overwrote that without a backup.
Oh and worse, i messed up the clocks so usb-serial didn't work !
:lol:

https://github.com/WeActTC/MiniSTM32H7xx
This is a much better photo from the repository, it looks exactly like this, a well made board.
Image

specs for the chip here
https://www.st.com/en/microcontrollers- ... 743vi.html

The led blinks from a hacked up custom variant with STM core.
The clock settings is one of the very complicated ones I've encountered thus far, 3 different PLL where you can set the M,N,P,Q divisors independently. That's not all the whole thing is funnelled into a complicated clock multiplexer so that you could route clocks to different peripherals and blocks from the PLL.
And I thought initially that I'd only need one PLL, only to find out that the clocks for the different peripherals, ADC, USB, USART, SPI, I2C, Timers etc are all scattered across the 3 PLLs at the different P, Q, R clock sources ! So I switched on clocks for everything.

The led blinks is a badly done 'breathing led' pwm :lol:
ag123
Posts: 1798
Joined: Thu Dec 19, 2019 5:30 am
Answers: 28

Re: STM32H743VIT6

Post by ag123 »

oops I stumbled in a ditch, couldn't get usb to work on stm32h743vi

edit, updated from next post/comment
key clock configs are like such:

Code: Select all

  RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
  RCC_OscInitStruct.HSEState = RCC_HSE_ON;
  RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
  RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
  // 480 Mhz
  RCC_OscInitStruct.PLL.PLLM = 5; // M div 5
  RCC_OscInitStruct.PLL.PLLN = 96; // N mul 96
  RCC_OscInitStruct.PLL.PLLP = 1; // P div 1
  RCC_OscInitStruct.PLL.PLLQ = 10; // Q div 10 - USB 48 Mhz
  RCC_OscInitStruct.PLL.PLLR = 10; // R unused
To interpret the numbers, HSE is 25 Mhz, so I'd need to divide it by M = 5. That gives me 5 Mhz. Then multiply by N = 96.
That's the VCO speeds ~ 480 Mhz. system clock takes its clock from PLL1 P, so set P = 1.
Now system clock is 480 Mhz, the spec speeds. Blink works.

Next thing is usb, this is 'hairy' and rather difficult. USB takes its clock from one of 3 sources:
1 PLL1 Q
2 PLL3 Q
3 HSI48.

Hence, I've configured it for PLL1 Q.
To get 48 Mhz, divide VCO speeds by 10 ~ 480 Mhz / 10 = 48 Mhz so set Q = 10.
It looks 'good' but that usb cdc serial doesn't enumerate. I'm not sure what is wrong, I'd assume it has something to do with the clocks e.g. incorrect clocks.

The whole clock config is as follows, pretty 'complicated', PLL2 and PLL3 outputs P, Q, R are all set to 80 Mhz. This is to run all the pheriperials.
80 Mhz is the max allowable for ADC. (ref manual even put a clause that M,N,P,Q,R divisors needs to be even to get a 50% duty cycle. It isn't quite that way here as I'm trying to fix usb first.)
edit, updated

Code: Select all

/**
  * @brief  System Clock Configuration
  * @param  None
  * @retval None
  */
WEAK void SystemClock_Config(void)
{
  RCC_OscInitTypeDef RCC_OscInitStruct = {};
  RCC_ClkInitTypeDef RCC_ClkInitStruct = {};
  RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {};

  /** Supply configuration update enable
  */
  HAL_PWREx_ConfigSupply(PWR_LDO_SUPPLY);
  /** Configure the main internal regulator output voltage
   *  Run mode (VOS0 to VOS3)
   * Scale 0: boosted performance (available only with LDO regulator)
   * Scale 1: high performance
   * Scale 2: medium performance and consumption
   * Scale 3: optimized performance and low-power consumption
   *
  */
  __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE0);

  while (!__HAL_PWR_GET_FLAG(PWR_FLAG_VOSRDY)) {}
  /** Initializes the RCC Oscillators according to the specified parameters
  * in the RCC_OscInitTypeDef structure.
  */
  //RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI48 | RCC_OSCILLATORTYPE_HSI;
  /* PLL1 pclk is sysclk 480 Mhz */
  RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
  RCC_OscInitStruct.HSEState = RCC_HSE_ON;
  RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
  RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
  // 480 Mhz
  RCC_OscInitStruct.PLL.PLLM = 5; // M div 5
  RCC_OscInitStruct.PLL.PLLN = 96; // N mul 96
  RCC_OscInitStruct.PLL.PLLP = 1; // P div 1
  RCC_OscInitStruct.PLL.PLLQ = 10; // Q div 10 - USB 48 Mhz
  RCC_OscInitStruct.PLL.PLLR = 10; // R unused
  // 360 Mhz
  /*
  RCC_OscInitStruct.PLL.PLLM = 5; // M div 10
  RCC_OscInitStruct.PLL.PLLN = 144; // N mul 144 (add 1 to N)
  RCC_OscInitStruct.PLL.PLLP = 2; // P div 2 (add 1 to PLLP) must be even
  RCC_OscInitStruct.PLL.PLLQ = 15; // Q div 10 (add 1 to PLLQ) - USB 48 Mhz
  RCC_OscInitStruct.PLL.PLLR = 15; // R unused
  */

  /*
   * RCC_PLL1VCIRANGE_0  Clock range frequency between 1 and 2 MHz
   * RCC_PLL1VCIRANGE_1  Clock range frequency between 2 and 4 MHz
   * RCC_PLL1VCIRANGE_2  Clock range frequency between 4 and 8 MHz
   * RCC_PLL1VCIRANGE_3  Clock range frequency between 8 and 16 MHz */
  /*PLLRGE: RCC_PLL1VCIRANGE_2 Clock range frequency between 4 and 8 MHz  */
  RCC_OscInitStruct.PLL.PLLRGE = RCC_PLL1VCIRANGE_2;
  /* VCOSEL PLL1VCOWIDE 2-16 Mhz*/
  RCC_OscInitStruct.PLL.PLLVCOSEL = RCC_PLL1VCOWIDE;
  RCC_OscInitStruct.PLL.PLLFRACN = 0;
  if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
    Error_Handler();
  }
  /** Initializes the CPU, AHB and APB buses clocks
  */
  RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK
                                | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2
                                | RCC_CLOCKTYPE_D3PCLK1 | RCC_CLOCKTYPE_D1PCLK1;
  RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
  RCC_ClkInitStruct.SYSCLKDivider = RCC_SYSCLK_DIV1;
  RCC_ClkInitStruct.AHBCLKDivider = RCC_HCLK_DIV2;
  RCC_ClkInitStruct.APB3CLKDivider = RCC_APB3_DIV2;
  RCC_ClkInitStruct.APB1CLKDivider = RCC_APB1_DIV2;
  RCC_ClkInitStruct.APB2CLKDivider = RCC_APB2_DIV2;
  RCC_ClkInitStruct.APB4CLKDivider = RCC_APB4_DIV2;
  if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_4) != HAL_OK) {
    Error_Handler();
  }

  PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_USB | RCC_PERIPHCLK_QSPI
                                             | RCC_PERIPHCLK_SDMMC | RCC_PERIPHCLK_ADC
                                             | RCC_PERIPHCLK_LPUART1 | RCC_PERIPHCLK_USART16
                                             | RCC_PERIPHCLK_USART234578 | RCC_PERIPHCLK_I2C123
                                             | RCC_PERIPHCLK_I2C4 | RCC_PERIPHCLK_SPI123
                                             | RCC_PERIPHCLK_SPI45 | RCC_PERIPHCLK_SPI6;
  /* PLL1 qclk used for USB 48 Mhz */
  /* PLL1 qclk also used for FMC, QUADSPI, SDMMC, RNG, SAI */
  /* PLL2 pclk is needed for adc max 80 Mhz (p,q,r same)*/
  /* PLL2 pclk also used for LP timers 2,3,4,5, SPI 1,2,3 */
  /* PLL2 qclk is needed for uart, can, spi4,5,6 80 Mhz*/
  /* PLL3 r clk is needed for i2c 80 Mhz (p,q,r same)*/
  /* the settings here makes PLL2, PLL3 clock outputs at 80 Mhz on all the P, Q, R outputs */
  PeriphClkInitStruct.PLL2.PLL2M = 15; // M DIV 15 vco 25 / 15 ~ 1.667 Mhz
  PeriphClkInitStruct.PLL2.PLL2N = 96; // N MUL 96
  PeriphClkInitStruct.PLL2.PLL2P = 2; // P div 2 
  PeriphClkInitStruct.PLL2.PLL2Q = 2; // Q div 2
  PeriphClkInitStruct.PLL2.PLL2R = 2; // R div 2
  // RCC_PLL1VCIRANGE_0  Clock range frequency between 1 and 2 MHz
  PeriphClkInitStruct.PLL2.PLL2RGE = RCC_PLL2VCIRANGE_0;
  PeriphClkInitStruct.PLL2.PLL2VCOSEL = RCC_PLL2VCOMEDIUM;
  PeriphClkInitStruct.PLL2.PLL2FRACN = 0;
  PeriphClkInitStruct.PLL3.PLL3M = 15; // M DIV 15 vco 25 / 15 ~ 1.667 Mhz
  PeriphClkInitStruct.PLL3.PLL3N = 96; // N MUL 96
  PeriphClkInitStruct.PLL3.PLL3P = 2; // P div 2
  PeriphClkInitStruct.PLL3.PLL3Q = 2; // Q div 2
  PeriphClkInitStruct.PLL3.PLL3R = 2; // R div 2
  // RCC_PLL1VCIRANGE_0  Clock range frequency between 1 and 2 MHz
  PeriphClkInitStruct.PLL3.PLL3RGE = RCC_PLL3VCIRANGE_0;
  PeriphClkInitStruct.PLL3.PLL3VCOSEL = RCC_PLL3VCOMEDIUM;
  PeriphClkInitStruct.PLL3.PLL3FRACN = 0;
  // ADC from PLL2 pclk
  PeriphClkInitStruct.AdcClockSelection = RCC_ADCCLKSOURCE_PLL2;
  // USB from PLL1 qclk
  PeriphClkInitStruct.UsbClockSelection = RCC_USBCLKSOURCE_PLL;
  // QSPI from PLL1 qclk
  PeriphClkInitStruct.QspiClockSelection = RCC_QSPICLKSOURCE_PLL;
  // SDMMC from PLL1 qclk
  PeriphClkInitStruct.SdmmcClockSelection = RCC_SDMMCCLKSOURCE_PLL;
  // LPUART from PLL2 qclk
  PeriphClkInitStruct.Lpuart1ClockSelection = RCC_LPUART1CLKSOURCE_PLL2;
  // USART from PLL2 qclk
  PeriphClkInitStruct.Usart16ClockSelection = RCC_USART16CLKSOURCE_PLL2;
  // USART from PLL2 qclk
  PeriphClkInitStruct.Usart234578ClockSelection = RCC_USART234578CLKSOURCE_PLL2;
  // I2C123 from PLL3 rclk
  PeriphClkInitStruct.I2c123ClockSelection = RCC_I2C123CLKSOURCE_PLL3;
  // I2C4 from PLL3 rclk
  PeriphClkInitStruct.I2c4ClockSelection = RCC_I2C4CLKSOURCE_PLL3;
  // SPI123 from PLL2 pclk
  PeriphClkInitStruct.Spi123ClockSelection = RCC_SPI123CLKSOURCE_PLL2;
  // SPI45 from PLL2 qclk
  PeriphClkInitStruct.Spi45ClockSelection = RCC_SPI45CLKSOURCE_PLL2;
  // SPI6 from PLL2 qclk
  PeriphClkInitStruct.Spi6ClockSelection = RCC_SPI6CLKSOURCE_PLL2;

  if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK) {
    Error_Handler();
  }



  /** Enable USB Voltage detector
  */
  //HAL_PWREx_EnableUSBVoltageDetector();

}
Last edited by ag123 on Mon Nov 08, 2021 6:24 pm, edited 3 times in total.
ag123
Posts: 1798
Joined: Thu Dec 19, 2019 5:30 am
Answers: 28

Re: STM32H743VIT6

Post by ag123 »

yay did it :D

Code: Select all

[35365.194402] usb 3-4: new full-speed USB device number 94 using xhci_hcd
[35365.343601] usb 3-4: New USB device found, idVendor=0483, idProduct=0004
[35365.343603] usb 3-4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[35365.343603] usb 3-4: Product: BLACK_H743VITX CDC in FS Mode
[35365.343604] usb 3-4: Manufacturer: STMicroelectronics
[35365.343604] usb 3-4: SerialNumber: 367E375E3430
[35365.344035] cdc_acm 3-4:1.0: ttyACM0: USB ACM device
These are the PLL dividers

Code: Select all

  // 480 Mhz
  RCC_OscInitStruct.PLL.PLLM = 5; // M div 5
  RCC_OscInitStruct.PLL.PLLN = 96; // N mul 96
  RCC_OscInitStruct.PLL.PLLP = 1; // P div 1
  RCC_OscInitStruct.PLL.PLLQ = 10; // Q div 10 - USB 48 Mhz
  RCC_OscInitStruct.PLL.PLLR = 10; // R unused
it turns out that there is a catch while using HAL to set PLL dividers.

Code: Select all

#define __HAL_RCC_PLL_CONFIG(__RCC_PLLSOURCE__, __PLLM1__, __PLLN1__, __PLLP1__, __PLLQ1__,__PLLR1__ ) \
                  do{ MODIFY_REG(RCC->PLLCKSELR, (RCC_PLLCKSELR_PLLSRC | RCC_PLLCKSELR_DIVM1) , ((__RCC_PLLSOURCE__) | ( (__PLLM1__) <<4U)));  \
                      WRITE_REG (RCC->PLL1DIVR , ( (((__PLLN1__) - 1U )& RCC_PLL1DIVR_N1) | ((((__PLLP1__) -1U ) << 9U) & RCC_PLL1DIVR_P1) | \
                                ((((__PLLQ1__) -1U) << 16U)& RCC_PLL1DIVR_Q1) | ((((__PLLR1__) - 1U) << 24U)& RCC_PLL1DIVR_R1))); \
                    } while(0)
the codes subtract 1 from each of N, P, Q, R values instead of using register values directly. Hence, for HAL based dividers the actual divider value should be used.

Code: Select all

Vref int (1.21v):376
temp sensor:207
mvolt:666
temp:53.00
Vref int (1.21v):376
temp sensor:207
mvolt:666
temp:53.00
Vref int (1.21v):375
temp sensor:207
mvolt:667
temp:53.50
Beginning Whetstone benchmark at 480 MHz ...

Loops:10000, Iterations:1, Duration:1203.82 millisec
C Converted Single Precision Whetstones:830.69 Mflops
Beginning Whetstone benchmark at 480 MHz ...

Loops:10000, Iterations:1, Duration:1203.48 millisec
C Converted Single Precision Whetstones:830.93 Mflops

er erm pretty warm, I'd guess it is because I switched on every pheriperial pretty much, maybe it needs a heat sink :lol:

The fpu benchmarks looks good the whetstone benchmark is -O2 optimized, i'd not mind even if it cheats :lol:
Kenjutsu
Posts: 31
Joined: Tue Apr 07, 2020 10:58 am
Answers: 2

Re: STM32H743VIT6

Post by Kenjutsu »

Can I ask a noob question? :oops:

To successfully use this board with the Arduino IDE, what changes do I need to make? :)
Pieter

macOS: 14.5 M1
Arduino: 1.8.19
Arduino IDE: 2.3.2
STM32 Core: 2.8.0
ag123
Posts: 1798
Joined: Thu Dec 19, 2019 5:30 am
Answers: 28

Re: STM32H743VIT6

Post by ag123 »

ok here is it

0. u'd need to figure out where your stm32duino STM core files lives on your setup.
1. I've attached the variant files that I'm using currently.
The files variant_BLACK_H743VITX.cpp and variant_BLACK_H743VITX.h should probably live in

Arduino_Core_STM32/variants/H742V(G-I)(H-T)_H743V(G-I)(H-T)_H750VBT_H753VI(H-T)

where your core is installed

2. next find and edit boards.txt (make a backup of it just in case you have to restore it).
search for an existing entry to copy e.g. this entry

Code: Select all

# Generic H743VITx
GenH7.menu.pnum.GENERIC_H743VITX=Generic H743VITx
GenH7.menu.pnum.GENERIC_H743VITX.upload.maximum_size=2097152
GenH7.menu.pnum.GENERIC_H743VITX.upload.maximum_data_size=524288
GenH7.menu.pnum.GENERIC_H743VITX.build.board=GENERIC_H743VITX
GenH7.menu.pnum.GENERIC_H743VITX.build.product_line=STM32H743xx
GenH7.menu.pnum.GENERIC_H743VITX.build.variant=STM32H7xx/H742V(G-I)(H-T)_H743V(G-I)(H-T)_H750VBT_H753VI(H-T)
copy that and make a new set e.g.

Code: Select all

# Generic BLACK H743VITx
GenH7.menu.pnum.BLACK_H743VITX=Black H743VITx
GenH7.menu.pnum.BLACK_H743VITX.upload.maximum_size=2097152
GenH7.menu.pnum.BLACK_H743VITX.upload.maximum_data_size=524288
GenH7.menu.pnum.BLACK_H743VITX.build.board=BLACK_H743VITX
GenH7.menu.pnum.BLACK_H743VITX.build.product_line=STM32H743xx
GenH7.menu.pnum.BLACK_H743VITX.build.variant=STM32H7xx/H742V(G-I)(H-T)_H743V(G-I)(H-T)_H750VBT_H753VI(H-T)
GenH7.menu.pnum.BLACK_H743VITX.build.variant_h=variant_{build.board}.h
Note, I've not yet tested out this step as I'm using a Makefile, but I'd think it should be about there. You'd need to experiment with it.
It would be good to keep a backup of the updated boards.txt and the variant files as well, just in case a core update overwrite them.

3. restart Arduino IDE, search for the board, make a blink sketch etc and test

Code: Select all

void setup() {
	pinMode(LED_BUILTIN,OUTPUT);
}

void loop() {
	digitalToggle(LED_BUILTIN);
	delay(1000);
}
I installed the sketch/firmware using the on-chip USB DFU bootloader (press both reset and boot0, hold boot0 and release reset, release boot0 1 sec later). Then use something like stm32cubeprogrammer or dfu-util to install it. It probably 'just works' from within the Arduino IDE.

oh and clone this repository, WeAct is nice to collect the relevant stuff and documents and put it there. The schematics are there too.
https://github.com/WeActTC/MiniSTM32H7xx
for more 'formal' purpose, this board should probably be named after WeAct and their name for it MiniSTM32H743VI etc. For now I'd just call it 'black'

this is a good board, maybe it is the new black :lol:

oh and for these variant files, I've not checked everything in there, it is a 'fork' of the generic variant in the same directory.
I added clock configs that use HSE the onboard 25 MHz crystal, this is kind of 'alpha' or 'beta' codes till more people try it out.
Attachments
variantBLACK_H743VITX.zip
variant files for WeAct mini H743VITX
(4.91 KiB) Downloaded 681 times
ag123
Posts: 1798
Joined: Thu Dec 19, 2019 5:30 am
Answers: 28

Re: STM32H743VIT6

Post by ag123 »

If you use that board and the attached variant files in the previous post, report issues in this thread.
If things are after all stable, and that more people are using this with the board, I may make a PR for STM core.
I'd literally prefer it that the vendor does it, really, but I'd not mind making that PR for the core.

Do comment/feedback in this thread as well if you use the variant files and things works well for you, thanks ;)
Last edited by ag123 on Thu Nov 11, 2021 1:31 am, edited 2 times in total.
ag123
Posts: 1798
Joined: Thu Dec 19, 2019 5:30 am
Answers: 28

Re: STM32H743VIT6

Post by ag123 »

If the mcu runs too warm ~50 deg C at 480 Mhz, run it at a lower speed

that can be done by setting RCC_ClkInitStruct.SYSCLKDivider in the variant. e.g.

Code: Select all

  RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
  //RCC_ClkInitStruct.SYSCLKDivider = RCC_SYSCLK_DIV1;
  RCC_ClkInitStruct.SYSCLKDivider = RCC_SYSCLK_DIV2;
This set the divider to 2, which makes sysclock runs at 240 Mhz.
It runs quite a bit cooler that way, I see temperatures drop from 50 deg C to 40 deg C at 240 MHz.
But at 480 MHz it is good to run benchmarks to brag about the board ;)
ambient is around 30 deg C in these temperature readings.
Post Reply

Return to “STM32H7 based boards”