[SOLVED] Embarassed Newbie

Generic boards that are not Maple or Maple mini clones, and don't contain the additional USB reset hardware
Post Reply
dennyjim
Posts: 7
Joined: Tue Jan 09, 2018 1:18 pm

[SOLVED] Embarassed Newbie

Post by dennyjim » Wed Jan 31, 2018 1:07 pm

Hi I'm just getting started with STM32F103C8 and tried to run the test on pc13 I get an error

link:23: error: 'pc13' was not declared in this scope

pinMode(pc13, OUTPUT);

I ran this the other day with no problem.

Here is what I got
BlinkError.txt
(7.29 KiB) Downloaded 6 times
By nice I'm a 62 year old newbie and retention ain't that clever no more :? :? :?

electrobling
Posts: 23
Joined: Fri Jan 26, 2018 9:28 pm

Re: Embarassed Newbie

Post by electrobling » Wed Jan 31, 2018 1:15 pm

Did the one you ran the other day use "PC13", not "pc13"?

User avatar
mrburnette
Posts: 2201
Joined: Mon Apr 27, 2015 12:50 pm
Location: Greater Atlanta
Contact:

Re: Embarassed Newbie

Post by mrburnette » Wed Jan 31, 2018 1:21 pm

dennyjim wrote:
Wed Jan 31, 2018 1:07 pm
Hi I'm just getting started with STM32F103C8 and tried to run the test on pc13 I get an error

link:23: error: 'pc13' was not declared in this scope

pinMode(pc13, OUTPUT);

I ran this the other day with no problem.

Here is what I got

BlinkError.txt

By nice I'm a 62 year old newbie and retention ain't that clever no more :? :? :?
There are lot of examples in our section of github.com, they all "should" compile and run without error.
https://github.com/rogerclarkmelbourne/ ... s/examples

I'm 67, so I think I can answer your question from the prospective as one of your elders :D

Take a look at a proper example of blink below. Essentially, you must tell your sketch (program) what pc13 means ... you can do this several ways. Remember "upper/lower case matters!)

Code: Select all

#define BOARD_LED_PIN PB1        // Maple Mini board LED pin# 33
#define ONE_SECOND 1000          // 1000 mS
void setup() {
    // Set up the built-in LED pin as an output:
    pinMode(BOARD_LED_PIN, OUTPUT);
}

void loop() {
    digitalWrite(BOARD_LED_PIN,!digitalRead(BOARD_LED_PIN));// Turn the LED from off to on, or on to off
    delay(ONE_SECOND);          // Wait for 1 second (1000 milliseconds)
}
You will note above that I could have used BOARD_LED_PIN as 33 but rather elected to (more appropriately) use PB1. The deffinitions of Maple Mini pins was decided long ago by the original manufacturer: http://docs.leaflabs.com/static.leaflab ... i.html#id7

Of course, "PB" is a designation referring to Port B, a CMOS structure etched into the STM32F103 silicon. For the Maple Mini, the GPIO map looks like:
http://docs.leaflabs.com/static.leaflab ... rt-pin-map

Now, before going off and blinking your LED, let me briefly say that examples and demo programs do not always make good-sense but are designed for immediate gradification :shock:
For example, the code line that reads:

Code: Select all

delay(ONE_SECOND);          // Wait for 1 second (1000 milliseconds)
causes the uC to just sit at the line and do no work for 1000 milliseconds. Bit silly? There are ways to design software such that the loop() never gets strangled by a delay() or blocking command. As you learn, just remember that you need to move beyond blocking as quickly as possible to make the best use of the hardware resources. When you are ready, just google "non blocking Arduino".

Ray

dennyjim
Posts: 7
Joined: Tue Jan 09, 2018 1:18 pm

Re: Embarassed Newbie

Post by dennyjim » Wed Jan 31, 2018 2:08 pm

I just spent 30 minutes in a bath lookin at ma feet.......
and I was saying to myself "Is this really worth it?"
"do you really need all this hastle at your age?"

Then I come out the bath and see your reply. I bow to your greater knowledge Sire :)

I tried copying your text and pasting it into the blink sketch. Same end result just a different error.

Maybe it ain't worth it after all.
Thanks for trying
Jim

User avatar
mrburnette
Posts: 2201
Joined: Mon Apr 27, 2015 12:50 pm
Location: Greater Atlanta
Contact:

Re: Embarassed Newbie

Post by mrburnette » Wed Jan 31, 2018 2:16 pm

dennyjim wrote:
Wed Jan 31, 2018 2:08 pm
...
I tried copying your text and pasting it into the blink sketch. Same end result just a different error.
...
Jim,

There are many reasons why an error may occur. I am downloading the latest ArduinoIDE now and the most recent copy of Roger's github.
If you will share the error, I think we can get to the bottom of this. Things change on github all the time and it may be that the blink sketch needs to be slightly adjusted ... I'll know in a few minutes.

-----------------------------------------------------------------
ScreenBlink.png
ScreenBlink.png (61.15 KiB) Viewed 176 times

dennyjim
Posts: 7
Joined: Tue Jan 09, 2018 1:18 pm

Re: Embarassed Newbie

Post by dennyjim » Wed Jan 31, 2018 2:23 pm

I got it my friend ...... everything is case sensitive pc13 I had nedded PC13 :D

User avatar
mrburnette
Posts: 2201
Joined: Mon Apr 27, 2015 12:50 pm
Location: Greater Atlanta
Contact:

Re: Embarassed Newbie

Post by mrburnette » Wed Jan 31, 2018 2:34 pm

GREAT.

I'm an EE by training. At 21 and fresh out of the USAF, I was working as a senior computer (hardware) engineer. I had never programmed anything, but I was hell on the backplane of a number of the company's business systems. I learned COBOL to protect myself from the sales force who always would tell a customer that a product would work for them! I learned assembly so I could write maintenance test programs. I got fed up with it all and went to college where I formally took Fortran. Later in my jobs, I learned a number of new languages and later on I managed JAVA programmers although I could not write much of anything in JAVA.

... and yet, I still get frustrated with Arduino'ish anything! One reason is that the system is so simple, one overlooks the simple stuff and we are always digging looking for something difficult :lol:

Take your time. Blinks some LEDs. Visit a few of the online resources I listed here:
http://stm32duino.com/viewtopic.php?f=2&t=3111

Ray

Post Reply