Hello. Why error occurs when assigning PIN PB2 ? The rest of the PIN all is well.
#define TEST_BUTTON PB2
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
digitalRead(TEST_BUTTON);
}
Error
C:\Users\Admin\Documents\Arduino\sketch_jun19b\sketch_jun19b.ino: In function ‘void loop()’:
sketch_jun19b:1: error: ‘PB2’ was not declared in this scope
#define TEST_BUTTON PB2
C:\Users\Admin\Documents\Arduino\sketch_jun19b\sketch_jun19b.ino:10:13: note: in expansion of macro ‘TEST_BUTTON’
digitalRead(TEST_BUTTON);
exit status 1
‘PB2’ was not declared in this scope
#define TEST_BUTTON PB3
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
digitalRead(TEST_BUTTON);
}
No Error
What is the error PB2 ?
You could insert the line:
{&gpiob, NULL, NULL, 2, 0, ADCx}, /* PB2 */
{&gpiob, &timer3, &adc1, 1, 4, 9}, /* PB1 */
/* NOTE PB2 is not included as its Boot 1 */
{&gpiob, NULL, NULL, 2, 0, ADCx}, /* PB2 */
{&gpiob, NULL, NULL, 3, 0, ADCx}, /* PB3 */ //JTDO, SPI3_SCK / I2S3_CK/
{&gpiob, NULL, NULL, 4, 0, ADCx}, /* PB4 */ //NJTRST, SPI3_MISO
Did.
But the error remained.
What could be the problem ?
https://github.com/rogerclarkmelbourne/ … ard.h#L117
Error
c:\Users\Admin\Documents\Arduino\hardware\Arduino_STM32\STM32F1\variants\generic_stm32f103v\board.cpp:169:1: error: too many initializers for ‘const stm32_pin_info [79]’
};
^
https://github.com/rogerclarkmelbourne/ … oard.h#L94
It worked.
Thank you very much for the help !
Please set the title to [SOLVED] if it works.
[stevestrong – Mon Jun 19, 2017 9:10 am] –
Welcome.
Please set the title to [SOLVED] if it works.
Sounds like this a bug
Is the number in the header incorrect ?
[RogerClark – Mon Jun 19, 2017 10:38 am] –
Is the number in the header incorrect ?
Not quite, just that it has to be updated if you insert a new pin (PB2 in this case).
Although I don’t see any benefit to define that number ahead of the pin map.
So the potential issue is that pin PB1 is not in the pinmap
I think the Maple mini also uses this for its button. But there is IMHO a bug in the MM hardware, as there should be a weak pulldown on the button, to prevent the built in Serial bootloader reading Boot1 as High , ( because it is floating)
I did consider using the boot1 link on the bootloader as a button, but most people think its a bad or unnecessary idea.
( Personally I think its a useful addition to the bootloader, because on OSX and Linux, I think its difficult to upload by just pressing the reset button prior to upload, because the linux dfu-util does not seem to wait for the DFU device , like the windows version does.



