Olimex Support Forum

ARM => ST => Topic started by: poeltla on January 11, 2021, 11:33:30 pm

Title: Unable to upload Blink_LED Example to STM32-E407
Post by: poeltla on January 11, 2021, 11:33:30 pm
I am following CHAPTER 7 HOW TO USE THE BOARD WITH ARDUINO IDE.

At step 8 the USB device is not recognized by the Device Manager when the cable is plugged into USB_OTG1. Zadig does not list a USB device either.

Using USB_OTG2, however, the Device Manager recognizes the USB device "STM32 BOOTLOADER".

Using USB_OTG1 or Using USB_OTG2:
=================================
Sketch / Upload results in error message "You need to specify one of -D or -U"
Sketch / Upload using Programmer results in error message "java.lang.NullPointerException"

Power supply is 12V via barrel connector. PWR_SEL jumper is on the setting closest to the white connector. Other jumpers are on B0_1 and B1_0. I am pushing the reset button prior to attempting to program. OS is Windows 10 Enterprise Version 10.0.17763 Build 17763.

What am I doing wrong?

 
Title: Re: Unable to upload Blink_LED Example to STM32-E407
Post by: LubOlimex on January 12, 2021, 11:40:50 am
Seems like some problem with the Arduino IDE, what version of Arduino IDE are you using? Maybe test with different. I tested today with 1.8.12, and it seemed to work fine. Maybe the Arduino community would know more about this error.

There are couple of strange things:

The bootloader is on UBS_OTG1 here (the one near the Ethernet connector). I am pretty sure it is hardware assigned. I find it hard to believe it is on USB_OTG2 at your side.

You don't need to push the reset button before upload. The board would be in upload state (bootloader mode, SRAM) until you change the PTH jumper to the original position B0_0 (execution mode, user flash memory).

To simplify the powering, maybe set the jumper to USB powering, to save connecting the external power supply, the USB mini cable should sufficiently power the board. Make sure to set the jumper accordingly (the table for the USB position is printed at the bottom of the board).

Title: Re: Unable to upload Blink_LED Example to STM32-E407
Post by: poeltla on January 12, 2021, 02:52:17 pm
So UBS_OTG1 is the one near the Ethernet connector?

Then there is an error in the instruction manual Revision K, September 2018, page 9, Layout (Top View): USB-OTG#1 and #2 are swapped.

Now my observations regarding the USB device makes sense. I am now plugged into the USB port next to the Ethernet port and the PWR_SEL jumper is on the selection farthest from the white battery connector. Running dfu-util with option -l appears to list four memory sections on the board - so that's a promising sign.

I also uninstalled Arduino 1.8.13 and installed Arduino 1.8.12

So the remaining problem is that - when called from Arduino - dfu-util responds with "You need to specify one of -D or -U" So somehow Arduino is not calling dfu-util with the correct command line parameters.
Title: Re: Unable to upload Blink_LED Example to STM32-E407
Post by: poeltla on January 12, 2021, 03:29:23 pm
Update: I wrote a quick program that poses as dfu-util.exe to capture the command line parameters provided by Arduino:

0 dfu-util.exe
1 -a
2 0483:df11
3 -s
4 -D
5 0x08000000

It appears to me that the file name is missing from the command line parameters.

What tells Arduino what parameters to use? Is it defined in the Olimex package or are these parameters that need to be configured somewhere within Arduino?
Title: Re: Unable to upload Blink_LED Example to STM32-E407
Post by: poeltla on January 12, 2021, 04:31:35 pm
I think the problem is in

C:\Users\<username>\AppData\Local\Arduino15\packages\Olimex\tools\stm32-upload\1.0.0\win\maple_upload.bat
Title: Re: Unable to upload Blink_LED Example to STM32-E407
Post by: poeltla on January 12, 2021, 04:51:46 pm
I changed the last line in maple_upload.bat from

dfu-util.exe -a %2 -s %5 -D %4

to

dfu-util.exe -a %1 -s %4 -D %3

And now the file downloaded successfully and the LED is blinking