COM port dissappeared on Baite Maple Mini clone

Maple Mini, Maple Rev3, Maple Rev 5 and Maple Ret 6, iTead Maple etc
Post Reply
IPA
Posts: 5
Joined: Sat Mar 12, 2016 9:10 am

COM port dissappeared on Baite Maple Mini clone

Post by IPA » Sun Oct 09, 2016 7:11 pm

I have updated Arduino_STM32 and seem to have the disappearing COM port problem, that some others have mentioned here. I can program my Baite Maple Mini clone with the Arduino IDE, but the COM port never appears in the IDE or the windows device manager. The COM port was previously working, and it's the same with two different Baite boards. My setup is:

OS: Win10 Pro64
Arduino IDE: 1.6.10
Arduino_STM32: Arduino_STM-master.zip 9-Oct-16
Bootloader: STM32duino-bootloader 9-Oct-16
Board: BAITE blue pcb BTE14-07
CPU: STM32F103CBT6 (128k flash)

I understand from some posts here that there was an earlier a corrupt bootloader causing this problem, so I have today 9-Oct-16 downloaded and flashed maple_mini_boot20.bin into 0x08002000 using ST LINK V2 from:

https://github.com/rogerclarkmelbourne/ ... bootloader

But I still have no COM port.

Any helpful advice would be appreciated, I assume I have missed something but I don't know what. Also does anyone have a working link to the original maple bootloader please.

Thanks.

User avatar
RogerClark
Posts: 7482
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: COM port dissappeared on Baite Maple Mini clone

Post by RogerClark » Sun Oct 09, 2016 8:29 pm

Com port only appears when running a sketch that uses a com port.

Com port is not part of the bootloader, com port is part of the sketch.

Bootloader only provides DFU for the upload, then is terminated control switches to the sketch.

Its possible to break the sketch e.g. with a total crash, that will kill the com port in the sketch. (or if you attempt to use the same pins used by USB eg, set pinmode on them, or if you disable interrupts etc etc

IPA
Posts: 5
Joined: Sat Mar 12, 2016 9:10 am

Re: COM port dissappeared on Baite Maple Mini clone

Post by IPA » Sun Oct 09, 2016 9:34 pm

Thanks for the feedback. The sketch does use the com port, and it did work. I am doing some low level port programming, but not pins related to the USB port, but I will check again.

On the subject of "attempt to use the same pins", it is not clear to me what internal peripherals may already be configured by Arduino initialisation code and may be upset by me re configuring them. I'm setting a timer, ADC and some GPIO's. Is there any list of what peripherals are used ?

User avatar
RogerClark
Posts: 7482
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: COM port dissappeared on Baite Maple Mini clone

Post by RogerClark » Sun Oct 09, 2016 10:11 pm

I think PA11 and PA12 are the actual USB pins.

I don't know other internal resources are used by the USB code, e.g. interrupts timers etc etc, That sort of stuff has never been documented as its not something that most people generally change.

You'll need to look at the init code etc to work out what the MCU uses to maintain USB Serial

edogaldo
Posts: 285
Joined: Fri Jun 03, 2016 8:19 am

Re: COM port dissappeared on Baite Maple Mini clone

Post by edogaldo » Mon Oct 10, 2016 8:38 am

Apart from the COM port, does your sketch work?
You said you changed the bootloader to the new version, was this the first time you upgraded the bootloader?
If yes then it's most likely that previously you had the original Maple bootloader which loads sketches at address 0x08005000 and not 0x08002000.
In this case you should upload the sketch again using the new bootloader so that the sketch can be relocated in the new address.
If you have problems uploading the sketch consider putting the bootloader in perpetual mode: http://docs.leaflabs.com/static.leaflab ... bootloader

[edit] just noted:
I have today 9-Oct-16 downloaded and flashed maple_mini_boot20.bin into 0x08002000 using ST LINK V2
the bootloader must be written in 0x08000000 , not 0x08002000, the latter is the address where the bootloader puts the sketch..

Summarizing:
  • the bootloader must be at address 0x08000000
  • if using the original Maple bootloader (this is also the case for new Maple clones), the sketch must be at address 0x08005000
  • if using the bootloader 2.0, the sketch must be at address 0x08002000
Last edited by edogaldo on Mon Oct 10, 2016 9:07 am, edited 1 time in total.

User avatar
RogerClark
Posts: 7482
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: COM port dissappeared on Baite Maple Mini clone

Post by RogerClark » Mon Oct 10, 2016 9:04 am

edogaldo wrote:Apart from the COM port, does your sketch work?
You said you changed the bootloader to the new version, was this the first time you upgraded the bootloader?
If yes then it's most likely that previously you had the original Maple bootloader which loads sketches at address 0x08005000 and not 0x08002000.
In this case you should upload the sketch again using the new bootloader so that the sketch can be relocated in the new address.
If you have problems uploading the sketch consider putting the bootloader in perpetual mode: http://docs.leaflabs.com/static.leaflab ... bootloader

[edit] just noted:
I have today 9-Oct-16 downloaded and flashed maple_mini_boot20.bin into 0x08002000 using ST LINK V2
the bootloader must be written in 0x08000000 , not 0x08002000, the latter is the address where the bootloader puts the sketch..
The OP said in their last posting,
I am doing some low level port programming
So I suspect, they have basically broken the USB by doing something to resources required by the USB e.g. interrupts or perhaps timers or even GPIO settings (goodness knows)

edogaldo
Posts: 285
Joined: Fri Jun 03, 2016 8:19 am

Re: COM port dissappeared on Baite Maple Mini clone

Post by edogaldo » Mon Oct 10, 2016 11:27 am

So I suspect, they have basically broken the USB by doing something to resources required by the USB e.g. interrupts or perhaps timers or even GPIO settings (goodness knows)
May be but it seems to me they have broken the flash structure too.. :)

HexTank
Posts: 44
Joined: Fri Sep 30, 2016 10:46 am

Re: COM port dissappeared on Baite Maple Mini clone

Post by HexTank » Mon Oct 10, 2016 3:46 pm

Does this have anything to do with a failure to autoreset after uploadung via DFU too? I've gotten so used to having to hit reset after uploading each time I should perhaps start looking at what's causing it, I did see some threads about resistors and stuff, but none of the threads seemed to have any final solutions.

User avatar
RogerClark
Posts: 7482
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: COM port dissappeared on Baite Maple Mini clone

Post by RogerClark » Mon Oct 10, 2016 8:53 pm

If USB serial is not running, there is no programatic way to tell the board to reset so the bootloader can be run.

This is the problem with using USB HID instead of Serial etc as we cant send the reset message.

IPA
Posts: 5
Joined: Sat Mar 12, 2016 9:10 am

Re: COM port dissappeared on Baite Maple Mini clone

Post by IPA » Tue Oct 11, 2016 7:03 pm

Sorry in my haste I mislead, I meant to say "I flashed maple_mini_boot20.bin into 0x08000000 - 0x08002000 using ST LINK V2".

I have found the cause of the problem. It was, as suggested, an error in the GPIO settings in my code. A missing OR symbol was causing all of port B to be changed instead of a specific pin. Viz

//-------------------oops
GPIOB_BASE->CRH = ((3<<28)|(2<<30)); // PB15 on Pin28. Mode=3, o/p 50M. Cnf=2, Alternate Func PP.

This wouldn't affect the USB pins directly, but somehow it stopped the COM port appearing, although my code was still running and toggling bits.

Thanks for your feedback which helped me track down the problem. If anyone wants to understand further why it stopped the COM port appearing, a skeleton code that causes the problem is included below.


""""""""
#include "libmaple/gpio.h"

#define pled 33 // The LED
int ledtoggle;

void setup() {
pinMode(pled, OUTPUT);
Serial.begin(9600);
while (!Serial) { } // wait for serial port to connect.

// Set up output pin
GPIOB_BASE->CRH = ((3<<28)|(2<<30)); // PB15 on Pin28. Mode=3, o/p 50M. Cnf=2, Alternate Func PP. For TIM1_CH3N
}

void loop() {
ledtoggle ^=1;
digitalWrite(pled, ledtoggle);
Serial.print("Toggle "); Serial.println(ledtoggle);
delay(200);
}
""""""""

Post Reply