Yet another OSX Rant - Peculiar issue

Apple Mac OSX
Krish2487
Posts: 8
Joined: Mon Jan 09, 2017 5:44 pm

Yet another OSX Rant - Peculiar issue

Postby Krish2487 » Mon Jan 09, 2017 6:00 pm

Hello,
I am a long time lurker who has enjoyed the benifits of the STM32 (mbed platform) but have recently moved to arduino for STM32.

I have gone through the forums and tried to search for my issue but havent found any. I would not cause any unnecessary trouble if I could address this issue on my own.

I have successfully flashed the bluepill boards with the modified generic-PC13.bin using the stm32flash utility.
( I have added BOOTLOADER_WAIT 30 in the config.h file for PC13 target as seen on another thread).

I have also changed the upload_reset in the maple_upload script from 750 to 1500.

Running dfu-util -l gives me this

Code: Select all

dfu-util -l
dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

Deducing device DFU version from functional descriptor length
Found Runtime: [13d3:3295] ver=0531, devnum=4, cfg=1, intf=3, path="29-1.6", alt=0, name="UNKNOWN", serial="74F06DF56885"
Found DFU: [1eaf:0003] ver=0201, devnum=2, cfg=1, intf=0, path="20-1", alt=2, name="STM32duino bootloader v1.0  Upload to Flash 0x8002000", serial="LLM 003"
Found DFU: [1eaf:0003] ver=0201, devnum=2, cfg=1, intf=0, path="20-1", alt=1, name="STM32duino bootloader v1.0  Upload to Flash 0x8005000", serial="LLM 003"
Found DFU: [1eaf:0003] ver=0201, devnum=2, cfg=1, intf=0, path="20-1", alt=0, name="STM32duino bootloader v1.0  ERROR. Upload to RAM not supported.", serial="LLM 003"


I am using this maple_upload arguments to flash a blinky (PC13, 1 second toggle) with the serial.begin(115200) added to the setup loop. This is the code

Code: Select all

#include <Arduino.h>

void setup(){
        Serial.begin(115200);
        pinMode(PC13, OUTPUT);
        digitalWrite(PC13, HIGH);
}


void loop(){
        Serial.println("Hello World!");
        digitalWrite(PC13, !digitalRead(PC13));
        delay(1000);
}



This is the maple_upload with its arguments.

Code: Select all

./maple_upload /dev/ttydummy 2 1eaf:0003 /Users/krishi/ownCloud/Workspace/AVR/platformio/mbed_f103c8/.pioenvs/bluepill_f103c8/firmware.bin


It gives me this output

Code: Select all

Failed to open serial device.
dfu-util 0.8

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2014 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

dfu-util: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
Deducing device DFU version from functional descriptor length
Opening DFU capable USB device...
ID 1eaf:0003
Run-time device DFU version 0110
Claiming USB DFU Interface...
Setting Alternate Setting #2 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 0110
Device returned transfer size 1024
Copying data from PC to DFU device
Download   [=========================] 100%        20588 bytes
Download done.
state(8) = dfuMANIFEST-WAIT-RESET, status(0) = No error condition is present
Done!
Resetting USB to switch back to runtime mode


So far so good, Now I have to manually reset the board. Doing so the first time the PC13 is stuck high. Resetting it a second time it reverts to the "no sketch to run" mode by six quick flashes and then slow flashes. After a couple of seconds the led stops blinking altogether.

Looking at the output of the dfu-util this is what I get.

while the led is still flashing

Code: Select all

dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

Deducing device DFU version from functional descriptor length
Found Runtime: [13d3:3295] ver=0531, devnum=4, cfg=1, intf=3, path="29-1.6", alt=0, name="UNKNOWN", serial="74F06DF56885"
Found DFU: [1eaf:0003] ver=0201, devnum=3, cfg=1, intf=0, path="20-1", alt=2, name="STM32duino bootloader v1.0  Upload to Flash 0x8002000", serial="LLM 003"
Found DFU: [1eaf:0003] ver=0201, devnum=3, cfg=1, intf=0, path="20-1", alt=1, name="STM32duino bootloader v1.0  Upload to Flash 0x8005000", serial="LLM 003"
Found DFU: [1eaf:0003] ver=0201, devnum=3, cfg=1, intf=0, path="20-1", alt=0, name="STM32duino bootloader v1.0  ERROR. Upload to RAM not supported.", serial="LLM 003"


Once the led stops flashing

Code: Select all

dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

Deducing device DFU version from functional descriptor length
Found Runtime: [13d3:3295] ver=0531, devnum=4, cfg=1, intf=3, path="29-1.6", alt=0, name="UNKNOWN", serial="74F06DF56885"
Found DFU: [1eaf:0003] ver=0201, devnum=3, cfg=1, intf=0, path="20-1", alt=2, name="UNKNOWN", serial="UNKNOWN"
Found DFU: [1eaf:0003] ver=0201, devnum=3, cfg=1, intf=0, path="20-1", alt=1, name="UNKNOWN", serial="UNKNOWN"
Found DFU: [1eaf:0003] ver=0201, devnum=3, cfg=1, intf=0, path="20-1", alt=0, name="UNKNOWN", serial="UNKNOWN"


Now once the led stops flashing I cannot upload any other code using the maple_upload/dfu-util. Once I reset the board, as long as the board is the led flash mode I can upload another firmware file.

My Configuration is a hackintosh with functioning drivers ( Sierra). I have tried with a USB2 port and USB3. I have tried changing three cables. But the uploaded sketch does not run. Please help as to what I can do to help you nice people help me. :-)

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

Re: Yet another OSX Rant - Peculiar issue

Postby RogerClark » Mon Jan 09, 2017 8:07 pm

I am not sure if this is the same problem, but..

Did you see the post about Sierra requiring a modified version of the bootloader?
( and possibly a change to the core)

The post was in the last 2 or 3 weeks, so should not be too hard to find.

Note. I have not implemented the change to the bootloader etc into the master copy, as it could break things for all Windows and Linux users, which account for 95% of all users.

Krish2487
Posts: 8
Joined: Mon Jan 09, 2017 5:44 pm

Re: Yet another OSX Rant - Peculiar issue

Postby Krish2487 » Mon Jan 09, 2017 8:15 pm

After posting my request, I saw a pending pull request on the github repo by "jaredburkett" specifically for mac timing issues.
I downloaded the appropriate binary and ran the tests again. The same issue persists.

I have not specifically looked for any threads wrt sierra recompilation. I will go through the board again to see if I missed anything.

Thank you for the help roger! :-)

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

Re: Yet another OSX Rant - Peculiar issue

Postby RogerClark » Mon Jan 09, 2017 8:45 pm

OK.

Looking at the output from DFU Util, it looks like it is uploading.

You could try removing the Serial.begin and Serial.print and see if GPIO works on its own, as its possible that something else in Sierra is screwing up the USB Serial.

You could also try STM's F1 core rather than the LibMaple core as its USB implementation is completely different.

https://github.com/stm32duino

(There is a posting about how you install the STM core, as you can't do it via the boards manager at the moment as the BM install only works for the Nucleo)


BTW.
I do have a old Macbook Pro, but its slightly too old to allow me to install Sierra. I also have a Hackintosh, but its the same situation, too old for Sierra, and as both work fine on Yosemite, and El Capitan respectively, I'm in no rush to buy new hardware just for the latest version of MacOs (as every new version of MacOS seems to bring a more issues and incompatibilities with external hardware - e.g. my USB mixing desk no longer works with El Capitan)

Krish2487
Posts: 8
Joined: Mon Jan 09, 2017 5:44 pm

Re: Yet another OSX Rant - Peculiar issue

Postby Krish2487 » Mon Jan 09, 2017 8:52 pm

Thanks!! :-)
I assume you are referring to this thread roger??

viewtopic.php?f=3&t=1656

(Oh and tried by removing the Serial.begin() section too..)
Tried and same result. I ll try with the F1 core and post my findings. Maybe it might save someone else some frustration later.
:-D


PS: I am using platformio for my development and not the arduino IDE. Still, it should not really matter much.

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

Re: Yet another OSX Rant - Peculiar issue

Postby RogerClark » Tue Jan 10, 2017 2:48 am

Krish2487 wrote:Thanks!! :-)


PS: I am using platformio for my development and not the arduino IDE. Still, it should not really matter much.


I'd try the standard Arduino IDE, if possible, as Platformio has differences from the normal IDE which may be causing this

Krish2487
Posts: 8
Joined: Mon Jan 09, 2017 5:44 pm

Re: Yet another OSX Rant - Peculiar issue

Postby Krish2487 » Tue Jan 10, 2017 3:23 am

That did the trick roger!!
:-D

Auto reset works, upload works, it just works..

The serial port shows up.. serial comms are functional..
Any specific insight in what can be done to repeat the process on platformio IDE??

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

Re: Yet another OSX Rant - Peculiar issue

Postby RogerClark » Tue Jan 10, 2017 4:12 am

I think there is a thread somewhere on the forum about platformio, but I don't use it myself

About 90% of the forum members use the normal Arduino IDE. I few people use Eclipse, and some other IDE's (like visual studio), but its hard enough supporting the Arduino IDE (which seems to have a new version about one a month, which needs to be tested to confirm it still works OK)

Krish2487
Posts: 8
Joined: Mon Jan 09, 2017 5:44 pm

Re: Yet another OSX Rant - Peculiar issue

Postby Krish2487 » Tue Jan 10, 2017 4:40 am

Now, things are getting interesting.
I have the arduino and platformio IDE installed.

I have used a variety of permutations and combinations ( maple_upload (platformio IDE) and binary (arduino), maple_upload (platformio IDE) and binary (platformio IDE), maple_upload (arduino) and binary (arduino), maple_upload (arduino) and binary (platformio IDE) )
to understand what might be thee issue.

I was able to upload the binary with either of the maple_upload scripts. However the serial port enumerated only when I compiled from the arduino IDE.
The serial port did not enumrerate when I compiled the same code with platformio IDE. Further investigation into the size of the compiled binaries revealed a difference in size of almost 50%!!!

This is the code I compiled

Code: Select all

#include <Arduino.h>

void setup(){
        Serial.begin(115200);
        pinMode(PC13, OUTPUT);
        digitalWrite(PC13, HIGH);
}


void loop(){
        Serial.println("Hello World");
        digitalWrite(PC13, !digitalRead(PC13));
        delay(1000);
}


I am also attaching the binaries from both to indicate the size difference.

So to make it clear :-

1. Binaries compiled with the arduino IDE work.
2. Binaries compiled with the platformio IDE do not.
3. Binaries uploaded with either of the upload scripts work.

It makes me think if the compilation of the code in the platformio IDE itself is the issue for not enumerating the serial port.
Can I trouble you roger for an explicit command of the compilation command. ( I ll try to work it out myself also..)
I ll verify that against the platformio and that might reveal where the issue lies.

Thanks again for the help!! :-)

PS: I added the .txt at the end of the binaries since the forums sw was not allowing me to upload .bin files.
Attachments
firmware_PLATFORMIO.bin.txt
(8.55 KiB) Downloaded 9 times
firmware_ARDUINOIDE.bin.txt
(13.91 KiB) Downloaded 8 times

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

Re: Yet another OSX Rant - Peculiar issue

Postby RogerClark » Tue Jan 10, 2017 6:23 am

I suspect the platformio is not compiling the USB serial into the binary.

The bootloader only provides the DFU for upload. After the upload is complete, it simply jumps to the start of the sketch code, and if the skech has USB serial compiled in, you get USB Serial.

There are a whole bunch of "defines" (in boards.txt) which switch a variety of things (based on the menu settings in the IDE), but the main one if whether there is USB serial (as some boards have built in USB to serial devices, so don't need or want USB Serial)


Return to “OSX”

Who is online

Users browsing this forum: No registered users and 1 guest