Error led pin working with BluePill ?

Generic boards that are not Maple or Maple mini clones, and don't contain the additional USB reset hardware
Post Reply
michael_l
Posts: 336
Joined: Mon Aug 24, 2015 6:11 pm

Error led pin working with BluePill ?

Post by michael_l » Thu Jun 15, 2017 8:51 am

Seems error led pin works with Maple Mini. If my code crashed led starts the fade in/out loop. But this doesn't seem to work with Blue board. Any way to enable it ?

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

Re: Error led pin working with BluePill ?

Post by RogerClark » Thu Jun 15, 2017 10:46 am

Thats an interesting point.

I have seen that LED flash on the Maple Mini, but it probably does not work on other boards

There is code in cores/maple/libmaple/util.c

That uses these defines

ERROR_LED_PORT
ERROR_LED_PIN

Try modifying boards.txt around line 179 in the genericSTM32F103C section and below the line

Code: Select all

genericSTM32F103C.upload.auto_reset=true
add these 2 new lines

Code: Select all

genericSTM32F103C.build.error_led_port=GPIOC
genericSTM32F103C.build.error_led_pin=13
Let me know how you get on, as I may add this to the core, as most people who use a genericSTM32F103C are actually using a BluePill

michael_l
Posts: 336
Joined: Mon Aug 24, 2015 6:11 pm

Re: Error led pin working with BluePill ?

Post by michael_l » Thu Jun 15, 2017 11:31 am

Yes, there seems to be a function in util.c 'throb' that gets called when abort occurs with a comment saying it fades the error LED on and off.

I'll report back after I've tested this.

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

Re: Error led pin working with BluePill ?

Post by RogerClark » Thu Jun 15, 2017 9:21 pm

Yes.

I think its that function.

BTW. There is also code to send a debug message about the error via the hardware serial, but I have never tested it, so I am not sure if it works.
I think it may use Serial2

michael_l
Posts: 336
Joined: Mon Aug 24, 2015 6:11 pm

Re: Error led pin working with BluePill ?

Post by michael_l » Sun Jun 18, 2017 5:21 pm

RogerClark wrote:
Thu Jun 15, 2017 9:21 pm
Yes.

I think its that function.

BTW. There is also code to send a debug message about the error via the hardware serial, but I have never tested it, so I am not sure if it works.
I think it may use Serial2
Yes, this works. It is kinda cool :-) I have blinking led with this line that results in "crash":

*((unsigned int*)0) = 0xDEAD;

But strange enough this :

int i = 1 / 0;

didn't crash my program.

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

Re: Error led pin working with BluePill ?

Post by RogerClark » Sun Jun 18, 2017 9:17 pm

Did you try the Serial 2 error text output ?


Re: 1 / 0

umm. Do you mean no crash at all, or an unhandled crash

michael_l
Posts: 336
Joined: Mon Aug 24, 2015 6:11 pm

Re: Error led pin working with BluePill ?

Post by michael_l » Thu Jun 22, 2017 9:50 am

RogerClark wrote:
Sun Jun 18, 2017 9:17 pm
Did you try the Serial 2 error text output ?


Re: 1 / 0

umm. Do you mean no crash at all, or an unhandled crash
No, didn't try Serial2 yet. Based on the code it triggers only when an 'assert' fails.

I mean no crash at all, I was expecting the processor to abort and stop because that's a division by zero.

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests