Compilation? problem with Arduino 1.8.12 and Olimexino STM32 board

Development environment specific, Arduino, Eclipse, VS2013, Em::Blocks etc
Post Reply
Phono
Posts: 59
Joined: Thu Mar 19, 2020 9:32 am

Compilation? problem with Arduino 1.8.12 and Olimexino STM32 board

Post by Phono »

Hi all,
I have developped a set of applications for the Olimexino STM32 board (a clone of Maple) back in 2014, first using the Maple environment, then I moved to the Arduino 1.8.3 IDE with Roger's package that was constantly evolving through the years. I still use it now, my developments are stable and I am ok with this.
However, my development environment is far from reliable, having been patched again and again. So I decided it was time to move to the new STM32Duino package, with the Arduino 1.8.12 IDE.
Indeed, the installation is much easier than before. No need to manually copy files at places, etc.
I ended up in a working environment, and I started the porting of my applications into this new environment.
For sake of safety i did not alter the computer I used to work with. I retrieved an old computer to do my tests, until I decide to update my newest computer. The old machine has been cleaned, and installed with Windows 10 before I started my trials. It worked rather quickly, and I started my porting work. One of the applications was already working: it involves the Ethernet library and FreeRTOS. Just to say it is not a simplistic sketch.
Unfortunately, last night my computer underwent an automatic windows update. Since then, I am unable to have an application work in my boards.
Since I have two environments, I can compare the results between the two for various experiments.
I started by cleaning my old computer again, unsintalling the IDE and the package, and re-installing the both.
I concentrated on two example applications: "blink" and "AnalogReadSerial".
Both work well on my newest computer. On the contrary, on my old computer, both applications compile with no warning, are uploaded to the board, and the board reboots, then nothing happens. Neither the LED blinks, nor the analog values can be shown in the serial monitor. Moreover, the USB com port (COM4 in my case) is not detected by the computer, whereas it is ok with the new computer.
So I can put to hypothesis:
-either the code is wrongly compiled;
-or it is wrongly uploaded.

At upload time, I get exactly the same output, that I paste below:

Code: Select all

maple_loader v0.1
Resetting to bootloader via DTR pulse
Searching for DFU device [1EAF:0003]...
Found it!

Opening USB Device 0x1eaf:0x0003...
Found Runtime: [0x1eaf:0x0003] devnum=1, cfg=0, intf=0, alt=1, name="DFU Program FLASH 0x08005000"
Setting Configuration 1...
Claiming USB DFU Interface...
Setting Alternate Setting ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
Transfer Size = 0x0400
bytes_per_hash=288
Starting download: [##################################################] finished!
error resetting after download: usb_reset: could not reset device, win error: Un périphérique qui n’existe pas a été spécifié.
state(8) = dfuMANIFEST-WAIT-RESET, status(0) = No error condition is present

Done!

Resetting USB to switch back to runtime mode
with the exception that the last sentence is followed by a timeout to reach COM4 on the old computer.
Another difference is that the size of the hashes is 288 in the good case, 176 in the wrong case. The transfer size is 0x400 in both cases.
Please note the error message saying (in french) that a non existent peripheral was specified. I have lived with this for years without any problem.

Can I suspect the windows update to have created some incompatibility that did not exist before? What can I try other than what I already did?

Phono
Posts: 59
Joined: Thu Mar 19, 2020 9:32 am

Re: Compilation? problem with Arduino 1.8.12 and Olimexino STM32 board

Post by Phono »

I went a bit further in my investigation.
I had chosen for the chip "STM103xxx" and for the variant, "Maple mini".
I overlooked the fact that the Maple Mini uses a smaller footprint chip, the STM103C, whereas the Olimexino board uses the STM103R. Thus the pin allocation was different.
In the example sketch "blink" I changed the pin number so that it would end up to the LED fitted on my board. And then, the program worked. The LED started to blink.
When I tried to compare with my previous configuration (with Roger's core), I overlooked the fact that it was set for the Maple R3 board. This made the difference.
So a part of the mystery is gone.
But still, I am lacking the Serial USB device. My computer does not sense a COM port when the program starts, unlike in the regular case where the COM port shows up in the device list shortly after program start.
Without this com port I cannot flash again using the Maple bootloader, since it relies on the COM port to trigger a reset that will activate the boot loader temporarily.
The mystery is not complete, though, since two days ago I could see the COM port in the device list. I cannot explain this.
The conclusion is : I really need the Maple R3 option in the list of board variants.
Has someone the required knowledge to show me how to create an additional board?

User avatar
fpiSTM
Posts: 677
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 25
Location: Le Mans
Contact:

Re: Compilation? problem with Arduino 1.8.12 and Olimexino STM32 board

Post by fpiSTM »

You could probably use the Generic F103RBT6 (Blue Button) to perfom some tests. It is the closed one.

For USB you will have to define the DISC PIN which seems to be on PC12.
Source:
https://www.olimex.com/Products/Duino/S ... latest.pdf

I guess it should be fine to add a dedicated variant to this board:
https://github.com/stm32duino/wiki/wiki ... 28board%29

Phono
Posts: 59
Joined: Thu Mar 19, 2020 9:32 am

Re: Compilation? problem with Arduino 1.8.12 and Olimexino STM32 board

Post by Phono »

Thank you, I will try. However, I am not sure I will get the USB serial module functional. It should be included in the core of any sketch, and initialized prior to calling Loop, or maybe prior to calling Setup. The DTR virtual signal of the com port is used to actuate the DISC pin.
Is this function already present somewhere in the package?
PS what does blue button mean? Is it the name of a commercial board?

User avatar
fpiSTM
Posts: 677
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 25
Location: Le Mans
Contact:

Re: Compilation? problem with Arduino 1.8.12 and Olimexino STM32 board

Post by fpiSTM »

For USB select in the menu CDC (generic Serial...) and that's all.
For the DISC pin they have to be defined:
USB_DISC_PIN PC12

you can use the build_opt.h to define it at sketch level with:

Code: Select all

-DUSB_DISC_PIN=PC12
https://github.com/stm32duino/wiki/wiki ... uild_opt.h

About Blue button, this is for those boards:
https://stm32-base.org/boards/STM32F103 ... eric-Board

fredbox
Posts: 79
Joined: Thu Dec 19, 2019 3:05 am
Answers: 2

Re: Compilation? problem with Arduino 1.8.12 and Olimexino STM32 board

Post by fredbox »

I have a board with a similar disconnect circuit. In setup(), I set the disconnect pin to an output and digitalWrite the pin low so that the 1.5K resistor is always in the circuit. Put a Serial.begin() in setup. In the USB menu, enable CDC generic serial. Upload using ST-Link and the USB Serial port is instantly available on reset. No bootloader is needed.

Phono
Posts: 59
Joined: Thu Mar 19, 2020 9:32 am

Re: Compilation? problem with Arduino 1.8.12 and Olimexino STM32 board

Post by Phono »

Thank you very much. I followed your advice, and it works now.
The only difference is that after configuring the DISC pin as an output, I had to set it first high then low to produce a down-going edge, as is said in the Leaflabs documentation about the boot loader.

Post Reply

Return to “IDE's”