Arm Mbed OS support forum

STM32H743VIT6: no boot

Hi,

I am trying to use a STM32H743VIT6 mini board from Boring_tech (configured as Nucleo-H743ZI2) with Mbed studio and MbedOS 6.3.0. The board runs at 480 MHz. The download of the software is OK via the TX/RX (PA9/PA10) ports at the 0x8000000 default address. When I reset nothing occurs. Nothing from the serial port or even a simple blinking example does not run. Something wrong/missing?

The nucleo uses an external clock. What about your board? You may need to change to xtal clock.

External clock? You mean RTC ? There is a RTC inside but no connected battery. The internal clock seems correct: announced 480 MHz. I only see a stable blue led (another was blinking before the first load).
The simple code:

#include “mbed.h”

static BufferedSerial pc(PA_9, PA_10);
DigitalOut led(PC_0);
Ticker mainTimer;
char a_welcome[] = “STM32H743 20201002\r\n”;
volatile int cntout = 0;

void scheduler(void)
{
cntout++;
if ( (cntout % 200) == 20 )
{
led = !led; // 1 sec
}
cntout %= (720000);
}

// Mandatory to avoid crash (no RTC)
time_t read_rtc(void) {
return 0;
}

int main()
{
led = 0;

attach_rtc(&read_rtc, NULL, NULL, NULL); // Mandatory to avoid crash (no RTC)
mainTimer.attach(&scheduler, 5ms);

pc.set_baud(115200);
pc.set_format(
8, // bits
BufferedSerial::None, // parity
1 // stop bit
);

pc.write(&a_welcome[0],strlen(&a_welcome[0]));

while ( 1 )
{
wait_us(1000);
}
}

Hmm it does seem like the clock config would be a likely culprit. From what I can find about the board it seems like it has an 8MHz crystal. This matches the Nucleo V1 board, but the Nucleo V2 board uses a 25MHz crystal. Aha! So try setting the target as Nucleo-H743ZI instead of Nucleo-H743ZI2.

Hi Jamie,
The board is found here https://fr.aliexpress.com/item/4000117622966.html with the 3 buttons.
Running at 480 MHz I have already tested at 400 MHz (Nucleo-H743ZI files)… no luck.
The load of the board works perfectly but no boot at all.
It seems the board is for the garbage can.
Regards,
Alain

The problem is the clock as I mentionend already.
I have a similar board:
https://github.com/JojoS62/custom_targets/blob/master/TARGET_STM/TARGET_STM32H743xI/TARGET_DEVEBOX_H743VI/docs/STM32H7XX_M.jpg
you can try my custom_target with your board, the clock is set for 25 MHz xtal.
The Nucleos use external clock, this will fail and fallback to HSI clock. But HSI clock was buggy, it has been fixed a few days ago. But using my clock setting is better.
I still have a problem with getting the USB running, this issue is still not answered.

You are using another board: DevEBox. I am using a Boring_tech.
Just tested… nothing happens. A nightmare.
Last but not least I have ordered a DevEBox. I hope it will work with your modifications.

can you read the value of xtal x3? should be 25 or 8 MHz

Yes with a magnifying glass… :face_with_monocle: XT1 = 8.000 MHz and XT2 = 32.768 KHz.

ok, the Devebox uses 25 MHz. let me check what needs to be changed.
but at least it should run, only with wrong speed.

in system_clock.c, starting at line 234, you’ll find the clock setting that is used. you can replace it by:

#elif (USE_USBCLOCK == USE_PLL3Q)
    RCC_OscInitTypeDef RCC_OscInitStruct = {0};
    RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
    RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};

    /** Supply configuration update enable
     */
    HAL_PWREx_ConfigSupply(PWR_LDO_SUPPLY);
    /** Configure the main internal regulator output voltage
     */
    __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);

    while(!__HAL_PWR_GET_FLAG(PWR_FLAG_VOSRDY)) {}
    /** Macro to configure the PLL clock source
     */
    //__HAL_RCC_PLL_PLLSOURCE_CONFIG(RCC_PLLSOURCE_HSE);
    /** Initializes the RCC Oscillators according to the specified parameters
     * in the RCC_OscInitTypeDef structure.
     */
    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;          // 8 MHz
    RCC_OscInitStruct.PLL.PLLM = 2;   // 8 / 2 = 4 MHz
    RCC_OscInitStruct.PLL.PLLN = 240; // 480 MHz
    RCC_OscInitStruct.PLL.PLLP = 2;   // PLLCLK = SYSCLK = 480 MHz
    RCC_OscInitStruct.PLL.PLLQ = 96;  // PLL1Q used for FDCAN = 10 MHz
    RCC_OscInitStruct.PLL.PLLR = 2;
    RCC_OscInitStruct.PLL.PLLRGE = RCC_PLL1VCIRANGE_2;
    RCC_OscInitStruct.PLL.PLLVCOSEL = RCC_PLL1VCOWIDE;
    RCC_OscInitStruct.PLL.PLLFRACN = 0;
    if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
    {
        return 0; // FAIL
    }
    /** 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)
    {
        return 0; // FAIL
    }

    // USB Clock from PLL3
    PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_USB;


    PeriphClkInitStruct.PLL3.PLL3M = 4;                               // 8 MHz / 4 = 2 MHz
    PeriphClkInitStruct.PLL3.PLL3N = 96;                              // * 96 = 384 MHz
    PeriphClkInitStruct.PLL3.PLL3P = 4;                               // 384 / 4 = 48 MHz (unused)
    PeriphClkInitStruct.PLL3.PLL3Q = 4;                               // 384 / 4 = 48 MHz (USB)
    PeriphClkInitStruct.PLL3.PLL3R = 4;
    PeriphClkInitStruct.PLL3.PLL3RGE = RCC_PLL3VCIRANGE_2;
    PeriphClkInitStruct.PLL3.PLL3VCOSEL = RCC_PLL3VCOWIDE;
    PeriphClkInitStruct.PLL3.PLL3FRACN = 0;

    PeriphClkInitStruct.UsbClockSelection = RCC_USBCLKSOURCE_PLL3;
    if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
    {
        return 0; // FAIL
    }
    HAL_RCC_MCOConfig(RCC_MCO1, RCC_MCO1SOURCE_PLL1QCLK, RCC_MCODIV_10);

    /** Enable USB Voltage detector
     */
    HAL_PWREx_EnableUSBVoltageDetector();
#endif
    return 1; // OK
}

and in custom_targets.json, you need to change

          "hse_value": {
                "help": "HSE default value is 25MHz in HAL",
                "value": "25000000",
                "macro_name": "HSE_VALUE"

to “value”: “8000000”,

and you should start with a more simple blinky.

Changed all needed with full compilation and still no reaction. Nada.

16:25:51 : Memory Programming …
16:25:51 : Opening and parsing file: LDMosH743.bin
16:25:51 : File : LDMosH743.bin
16:25:51 : Size : 73848 Bytes
16:25:51 : Address : 0x08000000
16:25:51 : Erasing memory corresponding to segment 0:
16:25:51 : Erasing internal memory sector 0
16:25:52 : Download in Progress:
16:26:01 : File download complete

Playing with STM32F103, STM32F411, STM32F407x all work. Nothing from this board.

strange… How do you program the board? You said TX/RX, using the bootloader in ROM? Do you have some other probe for debugging?
And do have the schematics for the board?

I am using the USART TX/RX port (PA9/PA10) with the bootloader in ROM and STM32CubeProgrammer software (as other boards).
I dont have the schematic.
Maybe I can try with a ST-LINK V2 I have ? Never used.

with STLink, you need also only 3 wires, GND, SWCLK and SWDIO. Reset is optional, but when the program is hanging in a WFI instruction, you need to hold the reset button while trying to connect or connect also the reset wire.
The STLink tool is also easy to use, maybe its the same in Cube Programmer? I haven’t used the ROM bootloader.

After to upgrade the ST-Link firmware I can load the board with it.

More info: I have received the schematic… but I see some differences with my board (e.g. LED). I got the 2 buttons board version I have a 3 buttons version. Still unlucky.

I’ve discovered some problem with the LSE, 32 kHz oscillator. This affects the RTC and functions like ThisThread::sleep_for().
You can add

HAL_RCC_MCOConfig(RCC_MCO1, RCC_MCO1SOURCE_LSE, RCC_MCODIV_1);

to your main and check if there is a 32 kHz Signal at PA_8. A cheap multimeter with frequency measuring range is enough for this test.

Hi Johannes,
Just tested and nothing occurs. The clock is not on PA_8 but PC_15 (no available on the connector).
Regards,
Alain

that is wrong and maybe good :slight_smile:

could you add the two lines for LSEDRIVE_CONFIG and enabling LSE in system_clock.c

    /** Configure LSE Drive Capability
     */
    HAL_PWR_EnableBkUpAccess();
    __HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_HIGH);

    /** Macro to configure the PLL clock source
     */
    __HAL_RCC_PLL_PLLSOURCE_CONFIG(RCC_PLLSOURCE_HSE);
    /** Initializes the RCC Oscillators according to the specified parameters
     * in the RCC_OscInitTypeDef structure.
     */
    RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE|RCC_OSCILLATORTYPE_LSE;
    RCC_OscInitStruct.HSEState = RCC_HSE_ON;
    RCC_OscInitStruct.LSEState = RCC_LSE_ON;

after flashing this modification, the target needs to be powered down for a few seconds because the LSE is running in seperate power domain and keeps alive for some time.

Hi Johannes,

It works now!!! Thank you very much for your help. The UART message and the led work perfectly.

Regards,

Alain