Skip to main content
ATZ99
Associate II
September 22, 2022
Question

Control multiple STM32 simultaneusly

  • September 22, 2022
  • 6 replies
  • 3744 views

Goodmorning,

I am tying to understand the following case:

I've got two STM32F4 both connected to a usb hub, this hub is then connected to my pc. Is there a way to select the micro in which I need to load my firmware? I am not able to solve this out.

Thank you!

This topic has been closed for replies.

6 replies

Tesla DeLorean
Guru
September 22, 2022

Thru the ROM's System Loader, or your own USB DEVICE firmware?

Could you use the Serial Number?

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
ATZ99
ATZ99Author
Associate II
September 22, 2022

I am firstly trying to uploaded it by means of the st-link, so i've got two board with st-link and STM32F446RE (<- is this you mean by "serial number", isn't it?)

Tesla DeLorean
Guru
September 22, 2022

No,

The USB Descriptor with the Serial Number, perhaps derived from the STM32's UNIQUE ID

https://www.beyondlogic.org/usbnutshell/usb5.shtml

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
ATZ99
ATZ99Author
Associate II
September 22, 2022

ok got it, but I don't get how it can be usefull.

I mean, when the all system is connected to the pc, and I open the IDECubeMX, or Keil-uVision or whatever IDE, there is a way to chose which one micros use? and the serial number can be usefull?

Tesla DeLorean
Guru
September 23, 2022

The ST-LINK have unique serial numbers.

As USB Devices each can have a serial number that Windows can use to have different registry entries, so it doesn't instantiate another device if the port it is attached to changes..If you want a USB Device to be identifiable you need to ensure your code implements a sufficiently unique serial number.

How a debug pod recognizes individual STM32, honestly don't know. It's technically feasible, not sure the tools vendors are set up that way, typically they identify the pod and expect you not to keep switching them around.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
ATZ99
ATZ99Author
Associate II
September 23, 2022

I'll answer to both @Pavel A.​ and @Community member​ here, I got your messages, but I don't want to give up, so I ask you this: Is there a way in your opinion to deal with multiple STM32F4 with or without the ST-Link? escluding the hub way which based on your considerations it is not followable.

Tesla DeLorean
Guru
September 23, 2022

Perhaps you can use a Filter Driver, IOCTL, or URB's ?

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
ATZ99
ATZ99Author
Associate II
September 23, 2022

The filter driver seems a good way to do it, I don't find anything on the internet about URB's what are them?

Tesla DeLorean
Guru
September 24, 2022

You do seem to randomly commingle a whole bunch of ideas/concepts.

USB doesn't have RX,TX pins it has D+/D- pins the interface works in one direction at a time, using the two wires as a differential pair.

USB typically identifies unique devices by serial numbers, such that you can find/address a specific device.

On the USB Host side you can determine which ports a device is attached too.

You could load software on your USB devices to model their behaviour.

If you are programming the devices, and have the ability to read/write the MCU's memory space you could presumably query the UNIQUE ID ST burns into every device at production time.

Similarly a USB Device could use this unique number to compute its own serial number.

Perhaps master USB at some level

Write some USB Device code

Use the USB DFU mode of the STM32 System Loader

Use the USB DFU examples to create a user/flash based implementation

Write some PC side application software to communicate with USB Devices via the USB Host of the PC

Write some Windows Filter Drivers, understand how they fit into the USB Stack, and how they can interact with applications.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
ATZ99
ATZ99Author
Associate II
September 25, 2022

It is a new side of uC's for me, so I am trying to put together some ideas and some informations picked up during university courses.

It seems that I have lots of gaps to fill, starting from that voodoo of @Pavel A.​ which I have totally misunderstood thinking about a circuit. I think as last question I would ask if you have any suggestion to where find a good explanation of all the materials, like some books, or some online courses.

Thank you for the help