Skip to content

Request: setting DTR and RTS when using STM32CubeProgrammer (Serial) #2292

Closed
@gbr1

Description

@gbr1

Desktop:

  • OS: macOS 14.3.1
  • Arduino IDE version: 2.3.2
  • STM32 core version: 2.7.1
  • Upload method: STM32 Cube Programmer (Serial)

Board:

  • Name: STM32F4 based

Description:

STM32CubeProgrammer allows the set DTR and RTS values when uploading with serial method.
This seems impossible to do into Arduino framework stm32duino.

There isn't any option parameter in any menu to set DTR and RTS neither seems to be possible to do using a custom board.txt file.

Following is an example of a custom board.txt used in testing.

menu.opt=Optimize
menu.dbg=Debug symbols and core logs
menu.rtlib=C Runtime Library

my_custom_board.name=MY CUSTOM BOARD

my_custom_board.build.core=STMicroelectronics:arduino
my_custom_board.build.board=my_custom_board
my_custom_board.build.st_extra_flags=-D{build.product_line} {build.enable_usb} {build.xSerial} {build.bootloader_flags}
my_custom_board.build.mcu=cortex-m4
my_custom_board.build.fpu=-mfpu=fpv4-sp-d16
my_custom_board.build.float-abi=-mfloat-abi=hard
my_custom_board.build.series=STM32F4xx

my_custom_board.build.board=STMicroelectronics:GENERIC_F411RCTX
my_custom_board.build.product_line=STM32F411xE
my_custom_board.build.variant=STM32F4xx/F411R(C-E)T

my_custom_board.build.flash_offset=0x0
my_custom_board.upload.maximum_size=262144
my_custom_board.upload.maximum_data_size=131072


# Upload menu
my_custom_board.upload.protocol=1
my_custom_board.upload.options={serial.port.file} rts=low dtr=high
my_custom_board.upload.tool=STMicroelectronics:stm32CubeProg

Note: upload.protocol=1 means serial uploading.

When you upload from Arduino IDE, the script file stm32CubeProg.sh is called, and at line 144 it relies on this command:

${STM32CP_CLI} -c port=${PORT} ${MODE} ${ERASE:+"-e all"} -q -d "${FILEPATH}" "${ADDRESS}" -s "${ADDRESS}" "${OPTS}"

By reading the documentation of STM32CP_CLI, the -c parameter can accept rts and dtr parameter.

board.txt doesn't allow an "extra_options" parameter, so you have to put rts and dtr after {serial.port.file}. Unfortunately this doesn't work properly because the command interpreter splits upload.options parameter getting only the serial port name.
rts and dtr values are putted at the end of the line and skipped because they are not in -c flag parameter.

Using the OPTS, parameters are added at the end of the command, so they cannot be included in the -c flag.

You can review this by looking STM32CubeProgrammer logs in the terminal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions