I2C connection

Target configuration panel

This is the first panel to look at before connecting to a target. It allows the user to select the target interface, either the debug interface using an ST-LINK or J-Link debug probe, or the bootloader interface over UART, USB, SPI, CAN, or I2C.

With the refresh button, the user can check the available interfaces connected to the PC. If this button is pressed while the ST-LINK or J-Link interface is selected, the tool checks the connected ST-LINK or J-Link probes and lists them in the Serial numbers combo box. If the UART interface is selected, it checks the available communication ports of the PC and lists them in the Port combo box. If the USB interface is selected, it checks the USB devices in DFU mode connected to the PC and lists them in the Port combo box. Each interface has its own settings to configure before connection.

I2C settings

../../_images/I2C_configuration_panel_from_pdf.webp

Fig. 162 I2C configuration panel

  • Serial number: this field contains the serial numbers of all connected ST-LINK-V3 probes when using the I2C bootloader.

  • Port: selects the I2C devices connected to the PC. You can use the refresh button to recheck the available devices.

  • Baudrate: selects the I2C baud rate.

  • Address: adds the address of the slave bootloader in hexadecimal format.

  • Speed mode: selects the transmission speed mode, Standard or Fast.

  • Rise time: choose values according to the speed mode, 0-1000 for Standard and 0-300 for Fast.

  • Fall time: choose values according to the speed mode, 0-300 for Standard and 0-400 for Fast.

Connect command

-c, --connect

Description: Establishes the connection to the device. This command allows the host to open the chosen device port (UART/USB/JTAG/SWD/JLINK/SPI/CAN/I2C).

Syntax:

-c port=<Portname> [noinit=<noinit_bit>] [options]
  • port=<Portname>: Interface identifier, for example COMx on Windows, /dev/ttySx on Linux, usbx for USB interface, and SPI, I2C, or CAN for the corresponding interfaces.

  • [noinit=<noinit_bit>]: Sets No Init bits, value in {0, 1}, default 0. noinit=1 can be used if a previous connection is already active.

I2C options

  • [add=<ownadd>]: Slave address in hexadecimal format.

Note

The I2C address option must always be provided, otherwise the connection is not established.

Example using I2C

STM32_Programmer_CLI -c port=I2C add=0x38 br=400 sm=fast

In the connect command:

  • The add parameter changes from one device to another. Refer to AN2606 to determine the correct value. In this case, the STM32F42xxx bootloader address is 0x38.

  • The br baudrate parameter depends directly on the sm speed mode parameter. For example, if sm = standard, the baudrate does not support the value 400.

../../_images/I2C_connect_operation_from_pdf.webp

Fig. 163 Connect operation using I2C port

Note

For each I2C connection operation, the address parameter is mandatory. Not all devices implement this feature. Make sure that the target device supports an I2C bootloader.

There are other parameters used with the I2C port connection that have default values, while some others require specific values. See the help menu of the tool for more information.