Page 2 of 3

Re: Arduino IDE for Maple r5 program on STM32F103C8 issue

Posted: Fri Apr 17, 2020 9:38 am
by samtal
Took me some time to test and reply (was busy with my tractor fuel injection pump problem...), but after some thinking I realized that the STM32F103 built-in USB can never be used in an application like mine, when real-time data is supposed to be continuously and unattended sent up to a host computer by serial port.
The reason is that the F103 USB is pure software (probably some kind of bitbang?), and as such, it will always be reset at core's reset, and will not be able to re-open the port closed by the overall reset (can only be re-opened by the host computer).
I will therefore continue to use an external USB to Serial in this case.
As for other Arduino IDE STM32 applications, I am not sure it is the best way to go. The mixture of AVR and ARM libraries makes the program debug difficult. For STM32 ARM the right way to go seems to be any other specific ARM tool. I started to learn the free ST Cube programmer. It is not as simple as the Arduino is, but being knowledgeable in the Eclipse (and Visual Studio), this seems to be the right way for me.
This will necessitate to re-write the old and complex Maple program I have, but I may find that in the 10 years since I made it, a lot has changed to make the whole program look different.
As for the advice to "focus on your program" - The program in question has been running continuously for 9 years on a Maple-r5 (STM32F103RB), thus the problem is not with the program, but rather with its implementation with Arduino IDE for STM32 or/and the ST32_Smart board (similar to BluePill).
Thanks to all supporters so far
samtal

Re: Arduino IDE for Maple r5 program on STM32F103C8 issue

Posted: Fri Apr 17, 2020 10:02 am
by stevestrong
samtal wrote: Fri Apr 17, 2020 9:38 am The reason is that the F103 USB ... will always be reset at core's reset, and will not be able to re-open the port closed by the overall reset (can only be re-opened by the host computer).
That is true.
I wonder how did use the serial USB port so far so that you did not have this problem before. Had your old Maple board a USB to serial adapter on-board?
In this case the solution is exactly what you proposed, use an external USB to serial adapter to Serial1,2 or 3.

Re: Arduino IDE for Maple r5 program on STM32F103C8 issue

Posted: Fri Apr 17, 2020 10:43 am
by samtal
Yes, my Maple had an external USB to USART (Silicon labs) that was built-in in the same box. I did not look in the box, and after years, I forgot all about it.
When I first looked at the STM32 board's spec and found there was a built-in USB, I did not realize (actually, didn't think about it at all!) it was implemented in the core, and was happy to see that I will not need the external USB (Now I realize it was also available in the maple STM32F103RB which was new to me then).
Well, I was mistaken.
The Arduino's are smarter, implementing the USB as an on-board chip.

Re: Arduino IDE for Maple r5 program on STM32F103C8 issue

Posted: Fri Apr 17, 2020 4:31 pm
by stevestrong
As a workaround, you could check within your application if the USB serial port has been closed (due to HW reset), and if yes, then close and reopen the connection again.

Re: Arduino IDE for Maple r5 program on STM32F103C8 issue

Posted: Fri Apr 17, 2020 6:32 pm
by mrburnette
samtal wrote: Fri Apr 17, 2020 9:38 am ...
As for other Arduino IDE STM32 applications, I am not sure it is the best way to go. The mixture of AVR and ARM libraries makes the program debug difficult. For STM32 ARM the right way to go seems to be any other specific ARM tool. I started to learn the free ST Cube programmer. It is not as simple as the Arduino is, but being knowledgeable in the Eclipse (and Visual Studio), this seems to be the right way for me.
This will necessitate to re-write the old and complex Maple program I have, but I may find that in the 10 years since I made it, a lot has changed to make the whole program look different.
...
samtal
Yes, lots has happened. LeafLabs stopped making and supporting the Maple brand of boards. Roger Clark and others in the Arduino.cc forum took up migrating the work of LeafLabs to a format compatible with ArduinoIDE 1.5x. Then the Maple bootloader was rewritten to V2.0 so that it released the SRAM that was previously used (and lost after the bootloader ran.) Then lastyear, Roger's forum crashed and STM corporate created this new forum. Over time, STM has created the next-generation Arduino core based upon their professional environment. Essentially this is the core that I always recommend to new users since it is alive and active! LeafLabs' core is dead and Roger's core is on life-support.

Please see below for all of the various boards and uC that are now possible to be programmed using STM's tools:
https://github.com/stm32duino/Arduino_Core_STM32
There is even a tutorial on how to modify the Arduino compile scripts to support your own one-off board:
https://github.com/stm32duino/wiki/wiki ... 28board%29


Ray

Re: Arduino IDE for Maple r5 program on STM32F103C8 issue

Posted: Fri Apr 17, 2020 7:11 pm
by stevestrong
mrburnette wrote: Fri Apr 17, 2020 6:32 pm LeafLabs' core is dead...
Well, Ray, that is not right.
I am exclusively using the Libmaple core for every project I initiate. And I actively supporting my fork, and Roger's, too, dependent on available time.
I am not yet ready for the official core and I do not see why I should change to it.
If I am missing a feature in Libmaple core then I am implementing it in Libmaple core rather then switching to the new one.
But of course this is everyone's own choice to use one or the other core.

Re: Arduino IDE for Maple r5 program on STM32F103C8 issue

Posted: Fri Apr 17, 2020 7:53 pm
by samtal
OK. Now i am totally confused.
As I originally wrote, I have an old complex Maple program that was running for years on Maple r5 board that is now dead.
I want now to make it run on STM32_Smart board (ST32F103C8, resembles the Blue Pill). I have the original Maple IDE 0.0.12 (Arduino 018) version from 2011, running on Win10, on which my program compiles nicely, but will not upload.
If the Maple is still alive (one way or another) as stevestrong imply, what do I need to do in order to upload my program to the board? Is there a new Maple IDE version that will recognize the board?
I have tried to port the program to Arduino, but due to the number of various libraries I need (DMA, Flash, RTC, Math) and their interlaced requirements for other libs, it becomes difficult to make it compile.

Thx

Re: Arduino IDE for Maple r5 program on STM32F103C8 issue

Posted: Fri Apr 17, 2020 8:39 pm
by stevestrong
If you still have the libmaple core files and libraries from that time, it should be a simple task to port the project to be handled by Arduino instead of Maple IDE.
There is no need for any new core files, just adapt the file structure to Arduino IDE.
This way you could get rid of the compilation errors.
However, the RB series may have hardware not available on C8 series, that means it may not be possible to implement the same software on C8 series.

Re: Arduino IDE for Maple r5 program on STM32F103C8 issue

Posted: Fri Apr 17, 2020 8:52 pm
by mrburnette
stevestrong wrote: Fri Apr 17, 2020 7:11 pm
mrburnette wrote: Fri Apr 17, 2020 6:32 pm LeafLabs' core is dead...
Well, Ray, that is not right.
I am exclusively using the Libmaple core for every project I initiate. And I actively supporting my fork, and Roger's, too, dependent on available time.

I am not yet ready for the official core and I do not see why I should change to it.
If I am missing a feature in Libmaple core then I am implementing it in Libmaple core rather then switching to the new one.
But of course this is everyone's own choice to use one or the other core.
You are not using this: https://github.com/leaflabs/libmaple
Which LeafLabs state is
libmaple is inactive and no longer accepting submissions. Please consider
www.stm32duino.com instead.
BUT, the "stm32duino.com" referenced is the Roger Clark version from last years before the site crashed and was reborn under STM's control.

The fact that you are "evolving" your version, pulled at some point-in-time from Roger's git for your needs does not, IMHO, mean that the the libmaple is alive and kicking happily. What I said about Roger's version is that it was on life-support; never insinuated it was dead and never made direct reference to your git version. I believe, upon rereading, that I was quite specific and accurate in my statements.

I also would feel uncomfortable suggesting to a knowledgeable user that wants to migrate to STM as stated thus:
I started to learn the free ST Cube programmer. It is not as simple as the Arduino is, but being knowledgeable in the Eclipse (and Visual Studio), this seems to be the right way for me.
This will necessitate to re-write the old and complex Maple program I have, but I may find that in the 10 years since I made it, a lot has changed to make the whole program look different.
that they should install your core version because it is supported. All these versions are confusing and I simply wished to give the Op another "Arduino-ish" path to explore which may be easier than dealing with a major port effort. I cannot say that my suggestion of using STM's Official Arduino methodology would be any more (or less) painful than using Roger's or Steve's core. I do know that STM has made great strides with their effort and their commitment to the effort feels very genuine.

Now, if you feel that you have the bandwidth to support your Steve's core version actively and long-term, that is of course your prerogative... the Op is listening.


Ray

Re: Arduino IDE for Maple r5 program on STM32F103C8 issue

Posted: Sat Apr 18, 2020 6:36 am
by samtal
As was suggested by mrburnette, I downloaded the https://github.com/stm32duino/Arduino_Core_STM32.
I am not sure on how to run it on Windows. I did not find any exe to launch the Arduino among the files.
Shall I somehow merge it with an existing Arduini IDE?
Once I get it up and running, I will probably also need to add a new variant for the STM32_Smart F103C8
Please advise.
Thx