Page 1 of 2

pin addressing

Posted: Tue Dec 15, 2020 8:04 am
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

Re: pin addressing

Posted: Tue Dec 15, 2020 8:15 am
by fpiSTM
First of all which core you used and which STM32 ?

Normally, using PB9 should be ok.

Re: pin addressing

Posted: Tue Dec 15, 2020 10:00 am
by stevestrong
Which board have you selected in Arduino IDE?

Re: pin addressing

Posted: Tue Dec 15, 2020 10:05 am
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?

Re: pin addressing

Posted: Tue Dec 15, 2020 10:35 am
by fpiSTM
OK so you used LibMaple core.
I let Steve answer ;)

Re: pin addressing

Posted: Tue Dec 15, 2020 4:35 pm
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.

Re: pin addressing

Posted: Wed Dec 16, 2020 5:13 am
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.

Re: pin addressing

Posted: Wed Dec 16, 2020 1:04 pm
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?

Re: pin addressing

Posted: Sat Dec 19, 2020 12:27 am
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, ...

Re: pin addressing

Posted: Mon Dec 21, 2020 5:11 am
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.