Activating DFU (USB programming) on STM32F303 - stm32

I am building a board based on the STM32F303RET6.
The Processor Datasheet, page 17/section 3.5, mentions programming can be done "using USART1 (PA9/PA10), USART2 (PA2/PA3) or USB (PA11/PA12) through DFU (device firmware upgrade)"
I am using a NUCLEO board with this processor.
I have connected the Vdd, Gnd, D+ and D- pins of USB to a NUCLEO board and disabled the power from the add-on programmer board.
However whenever I reboot it with BOOT0 HIGH the USB never enumerates any device.
I am connecting the pins directly to the USB plug without any external resistor. The datasheet seems to suggest these are not needed.
To make things a bit trickier, this processor has the additional particularity of not having a BOOT1 pin; it is a software bit.
My question is, does the processor actually support DFU by using the built in bootloader?
If so, how should one go about starting it and programming via USB?
Thank you very much,
Pedro.
PS: ST has actually got conflicting information about support for USB programming on this processor. While the Datasheet says it's supported, Application Note AN2606, page 81 (section 19) only mentions support for programming via USART1, USART 2 and I2C. It references the USARTs but it's unclear how they can be used.

I have connected the Vdd, Gnd, D+ and D- pins of USB to a NUCLEO board
and disabled the power from the add-on programmer board.
Check the actual voltage and current on Vdd. The host might limit the current, or shut the port down when the consumption exceeds 100mA before enumeration. Try it with an external power supply.
I am connecting the pins directly to the USB plug without any external
resistor.
You need an 1.5k pullup on D+ (full speed) or D- (low speed). This is from the STM32F3 Discovery schematics (that's an OTG socket, ignore the ID line for regular 4-wire ports)
When there is no pullup, the host can't detect when the device is plugged in, and therefore won't enumerate it.
ST has actually got conflicting information about support for USB programming on this processor. While the Datasheet says it's supported, Application Note AN2606, page 81 (section 19) only mentions support for programming via USART1, USART 2 and I2C.
There is no conflicting information there. Section 19 on page 81 refers to some other controllers.
The capabilities of your STM32F303RET6 are listed in table 36, section 18.1 on page 77. (As I've already pointed it out.) See also table 3 on page 23, line STM32F302xD(E)/303xD(E).

Related

How to send data from STM32 USB port to Raspberry PI USB port?

I want to send data through USB between STM32 and Raspberry Pi. I don't want to use USB to Serial convertor, but instead have a actual USB Connection (maybe CDC class). I have to send data at high rate (Full speed). Please guide on how to achieve this?
A USB-serial connector is simply a microcontroller implementing a USB CDC/ACM virtual COM port and bridging to a UART which you would connect to a microcontroller's UART interface.
In your case you can simply implement the CDC/ACM directly on the STM32 using either of its USB device controller peripherals (USB support varies depending on the specific device https://www.st.com/resource/en/application_note/dm00296349-usb-hardware-and-pcb-guidelines-using-stm32-mcus-stmicroelectronics.pdf).
How you actually implement that will depend on what specific part, and what library or framework ecosystem you are using (e.g. SPL, CubeMX, Mbed). There are reference implementations, examples, drivers and libraries for all of these.
Your milage may vary, but I have measured ST's own USB library and example CDC/ACM virtual COM for STM32F1xx on a 72MHz MCU achieving 700kbits/s. Note that the performance is independent of the baud rate you might set on the host when you open the he VCP. Setting the baud rate simply sends a control packet to the device that can be used to set the baud rate of a UART in bridging applications. In your case such control packets can be ignored. There are similar packets for modem control signals such as DTR, RTS, CTS and RI, which you might choose to us for flow control or other signalling.

Do I need a level converter for Raspberry Pi and STM32 to communicate via GPIO(UART) port?

I want to connect an STM32F407 Discovery board with a Raspberry Pi 4 Model B.
And I want to use UART as communication so I plan to use PD5&6 on STM32 and Pin8&10 on RPi. But after looking up online it says that the voltage of a STM32 port is 5V and RPi is 3.3V, so it seems that I need a level converter between them?
And there are also some articles says that not all the STM32 port are 5V, some are 3.3V. But I cannot find any of that information in the datasheet. Can anyone tell me where can I find these information?
Thank you very much ~ ~
The STM32 uses 3.3V as well. But it's 5V tolerant.
Just go ahead and connect them. There is no voltage difference.
You should have a look at the reference manual for that discovery board. It is here: STM32F407 Reference Manual.
There should be no issue connecting UARTs between those boards. Just remember to connect the TX from one to the RX of the other and vice versa. You can also use the CTS/RTS for flow control, but that isn't necessary as long as you are using baud rates of 115200 or slower.
Something else that I would recommended is to power the Raspberry Pi from the Discovery board. There should be pins for suitable power on the discovery. This is important because it gets both boards using the same power and ground so that the UART logic levels are consistent between the two. This may not be necessary, but I have had issues trying to connect two Nucleo boards SPI busses together if I didn't power one board from the other.

Olimax STM32-E407 cannot connect over SWD

Good day
The problem:
I am trying to connect/flash/debug a Olimax STM32-E407 dev board over SWD and I am not able
When trying to connect, using CubeProgrammer, I get: "No STM32 Target Found"
What I have tried:
I have connected a ST-link V3 mini to the pinout of the the 20pin header of the Olimax board including 3.3V, GND, SWDIO (PA13/Pin7), SWCLK (PA14/Pin9) and NRST (Pin15).
I am powering the powering the board from a power supply into the power jack
All jumpers and solder bridges are in stock places.
I have also tried manually pulling NRST to ground and doing a full chip erase, but that has not worked either.
I have used these ST-link debuggers on other boards I made and it works perfectly fine
I have 3 Olimax boards and none of them work
Any help would he hugely appreciated.
Debugging problems on microcontrollers have two general common methodes.
Hardware Problems:
In this part, it is highly recommended that use an oscilloscope to monitor circuit.
Make sure the microcontroller is powered with a correct and stable power supply.
Check the soldering quality and there is no short circuit on the board (especially between ground pins and other pins).
Check the NRST pin is high when the board is powered.
Remember that this reset is active low so during programming or debugging this pin should be high. Also, check this pin is debounced with a capacitor.
Also you can check the JTAG pins signals with an Oscilloscope to check if the programmer device is working fine.
Sometimes adding a capacitor between debugging pins and GND increases the bus capacitance and solves the problem. The value of the capacitor should be found by trying.
Software Problems
Check the programmer driver is correctly installed on your PC.
Check the programming method is true(for example maybe the board is designed to be programmed with SWD, not JATG).
Sometimes reducing the programming clock of the programmer solved the problem.
If all of these methods didn't work and you are sure that the board is fine, probably the programmer is broken, so change the programmer with another one.

How to flash without STLINK

My STLINKV2 is not working anymore, not detected by Linux, it failed after the first successful flash. I ordered a new one but it will take 60+ days to arrive. Meanwhile I have heard on Youtube you can program Bluepills directly by connecting cut open USB cable to certain pins and then using a jumper. But I cannot get any precie information on this, is this really possible and how?
You should use the embedded bootloader. You can flash it through several interfaces. Look at AN2606, maybe you can find an already written flasher. Good luck STM32CubeProgrammer handle it.
If you intend to program it through usb, look also at AN3156 all protocols document are referred in chapter 2 of AN2606
THOSE AREN'T CUT OPEN USB CABLES they are USB to serial adapters for arduino's bootloader
They connect them like this:
The problem is that this requires the Arduino STM32 bootloader to be flashed in it.
Another option will be to use STM32CubeProg this program allows you to program your stm over
Serial
SPI
I2C
USB
You'll need to set the BOOT0 and BOOT1 pins to the correct value (HIGH slash LOW) to allow it to go in flash mode during boot.
Here is semi outdated tutorial which tells most of the steps to program a STM using serial. (the Flash Loader Demonstrator is outdated and you should use STM32CubeProg)

FTDI eeprom programming using linux command line

We have a FTDI device, FT2232H and an EEPROM M93C46-WMN6TP. Is there a utility or a way to program the eeprom in Linux using command line? We do not have provision for GUI in Linux or for connecting it to a windows system.
There is a sample EEPROM folder provided with the driver package that cab used for programming the EEPROM device (/release/examples/EEPROM/write/ )
Write can be checked used the read program in /release/examples/EEPROM/read/
You can absolutely program an EEPROM with a FT232H, but you will have to write your own program.
I am more a Windows person, but the code should similar on Linux.
I just sent a tweet yesterday doing just this with an FT4222 board
that I will use for my USB device Nusbio v2.
https://twitter.com/MadeInTheUSB/status/808868754146914304
A video experimenting with the FT232H
https://www.youtube.com/watch?v=8i8_EFs_j0I
The EEPROM M93C46-WMN6TP protocol seems to be SPI
see datasheet page 6
I suppose you may already have an FT232H evaluation board, so once wired on a breadboard to your EEPROM all the 4 SPI wires (CLOCK, MOSI, MISO, CS) you can start talking to the EEPROM.
Unfortunately the source code from one EEPROM to another thing can change.
I know very well the I2C 24LC256 family and the SPI 25AA1024.
Some of my code is available on github, this is for the SPI EEPROM 25AA1024,
that should help
MadeInTheUSB.Nusbio.SPI.EEPROM_25AA1024
MadeInTheUSB.Nusbio.Components/EEPROM
You can find a 100% already made solution hardware and software at
Nusbio Thumbdrive
Using the source mentioned above.