pin addressing

Development environment specific, Arduino, Eclipse, VS2013, Em::Blocks etc
Masoud
Posts: 5
Joined: Tue Dec 15, 2020 7:52 am

pin addressing

Post by Masoud »

I have been using Arduino IDE to program ESP8266-07 and it worked gorgeously. now I want to use this IDE for STM32 but there is a tiny problem here. how should I address the pins which are marked in the picture. I have tried these labels for one of them and it didn't work for me: PB9, 46, D46. I got no errors but the board doesn't react to my commands.
here is my code:

Code: Select all


void setup() {

  pinMode(PB9, OUTPUT); 
  
//  pinMode(46, OUTPUT); 
//  pinMode(D46, OUTPUT); 

}

void loop() {
  
  digitalWrite(PB9, HIGH);
  delay(1000);
  digitalWrite(PB9, LOW);
  delay(1000);

//  digitalWrite(46, HIGH);
//  delay(1000);
//  digitalWrite(46, LOW);
//  delay(1000);

//  digitalWrite(D46, HIGH);
//  delay(1000);
//  digitalWrite(D46, LOW);
//  delay(1000);

}

Image
Attachments
1.png
1.png (95.84 KiB) Viewed 8788 times
User avatar
fpiSTM
Posts: 1738
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: pin addressing

Post by fpiSTM »

First of all which core you used and which STM32 ?

Normally, using PB9 should be ok.
stevestrong
Posts: 502
Joined: Fri Dec 27, 2019 4:53 pm
Answers: 8
Location: Munich, Germany
Contact:

Re: pin addressing

Post by stevestrong »

Which board have you selected in Arduino IDE?
Masoud
Posts: 5
Joined: Tue Dec 15, 2020 7:52 am

Re: pin addressing

Post by Masoud »

my chip is: STM32F103C8T7.
in the board manager I installed: STM32F1xx/GD32F1xx boards
in boards I select: Generic STM32F103C series.
I build it and collect the .bin file and transfer it to my chip using: SN-Link ISP V2.09.331.004n.


It didn't work for me. shouldn't I include a library for GPIO or something?
User avatar
fpiSTM
Posts: 1738
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: pin addressing

Post by fpiSTM »

OK so you used LibMaple core.
I let Steve answer ;)
stevestrong
Posts: 502
Joined: Fri Dec 27, 2019 4:53 pm
Answers: 8
Location: Munich, Germany
Contact:

Re: pin addressing

Post by stevestrong »

I just tried your sketch and it works for me.
How do you check whether it works or not? I simply shortcut PB9 to PC13 to see the onboard LED of bluepill blinking.
Do you have a custom board? If yes, then check the wiring.
To be sure that the SW works, you could also try the sketch on bluepill board.
If you use the bluepill board and it still does not work then your board may be faulty, try another one.
Masoud
Posts: 5
Joined: Tue Dec 15, 2020 7:52 am

Re: pin addressing

Post by Masoud »

that's weird. I have a custom board which I'm sure is working. because when I upload the original .bin file to it, it works fine.
let me give you more details about it.
this image shows how the buzzer is connected to the STM32.
Attachments
1.png
1.png (74.19 KiB) Viewed 8713 times
stevestrong
Posts: 502
Joined: Fri Dec 27, 2019 4:53 pm
Answers: 8
Location: Munich, Germany
Contact:

Re: pin addressing

Post by stevestrong »

Beside that I do not know what "BJT" and "101" stands for, I think a buzzer should be supplied with a higher frequency signal, not the 1 second blink period. Try to adjust the delay sequentially down to 10 (or even 1).
What does the original BIN? Can you post a link to the board?
.rpv
Posts: 43
Joined: Wed Dec 18, 2019 10:19 pm

Re: pin addressing

Post by .rpv »

Masoud wrote: Wed Dec 16, 2020 5:13 am that's weird. I have a custom board which I'm sure is working. because when I upload the original .bin file to it, it works fine.
let me give you more details about it.
this image shows how the buzzer is connected to the STM32.
Hi, as far as I know you have to use a limiting resistor between the pin and the transistor (bjt), the stm32 can't provide a lot of current on its pins (I think it's under 10mA), if the connection it's as on your picture it's pretty likely that you had kill the pin.

If not, your code it's pretty simple, the options are:

- You aren't using the correct board on arduino IDE.
- The board that you're using had an error on the pinout.
- There's a connection error: wrong ping connected, a faulty wire, buzzer/transistor wrongly connected, ...
Masoud
Posts: 5
Joined: Tue Dec 15, 2020 7:52 am

Re: pin addressing

Post by Masoud »

stevestrong wrote: Wed Dec 16, 2020 1:04 pm Beside that I do not know what "BJT" and "101" stands for, I think a buzzer should be supplied with a higher frequency signal, not the 1 second blink period. Try to adjust the delay sequentially down to 10 (or even 1).
What does the original BIN? Can you post a link to the board?
101 = 100 ohm resistor
BJT = transistor

I will try your solution but I have used this Buzzer with ESP8266 and while the 12V supply is connected to the Buzzer, it will make the noise.
Post Reply

Return to “IDE's”