Search found 406 matches

by GonzoG
Sun May 14, 2023 11:27 am
Forum: General discussion
Topic: BluePill fast 10 us Timer interrupt example code needed
Replies: 29
Views: 3904

Re: BluePill fast 10 us Timer interrupt example code needed

maybe something like this will help. #define LED_PORT GPIOC #define LED_PIN (1<<13) //LED on C13 #define IO_SET(port, pins) port |= (pins) #define IO_CLR(port, pins) port &=~(pins) #define IO_FLP(port, pins) port ^= (pins) #define GIO_SET(gpio, pins) IO_SET(gpio->ODR, pins) #define GIO_CLR(gpio...
by GonzoG
Sun May 14, 2023 7:17 am
Forum: General discussion
Topic: Unable to calculate/update Theta value for d-q transformation (Park Transformation)
Replies: 7
Views: 2098

Re: Unable to calculate/update Theta value for d-q transformation (Park Transformation)

There's "big" user error and your program crashes. ... Theta[200].... for(int n=2;n<200;n++) { ... Theta[n+1]=... } What do you mean? can you elaborate or suggest a fix? Theta is 200 element array - last element's index is 199. for(int n=2;n<200;n++) runs for n=2 to 199. There is no Theta...
by GonzoG
Sun May 14, 2023 7:00 am
Forum: General discussion
Topic: BluePill fast 10 us Timer interrupt example code needed
Replies: 29
Views: 3904

Re: BluePill fast 10 us Timer interrupt example code needed

... As Gonzo G suggested, I am not using digitalWriteFast anymore. I was expecting a higher speed. Am I wrong? Here is the code: #ifndef _NOP // required for some non Arduino cores #define _NOP() do { __asm__ volatile ("nop"); } while (0) #endif #define PIN PC13 void setup() { pinMode(PIN...
by GonzoG
Sat May 13, 2023 10:48 pm
Forum: General discussion
Topic: BluePill fast 10 us Timer interrupt example code needed
Replies: 29
Views: 3904

Re: BluePill fast 10 us Timer interrupt example code needed

DON'T use any fast IO libraries with stm32duino.
1. this library for AVR based boards. With STM32 core it uses standard digitalWrite();
2. digitalWriteFast() and digitalReadFast() are a builtin functions in STM32 core.

Code: Select all

digitalWriteFast(digitalPinToPinName(PA1),1);
//or
digitalWriteFast(PA_1,1);
by GonzoG
Sat May 13, 2023 10:32 pm
Forum: General discussion
Topic: Unable to calculate/update Theta value for d-q transformation (Park Transformation)
Replies: 7
Views: 2098

Re: Unable to calculate/update Theta value for d-q transformation (Park Transformation)

There's "big" user error and your program crashes.

Code: Select all

...
Theta[200]....

for(int n=2;n<200;n++)
{
...
Theta[n+1]=...
}
by GonzoG
Fri May 12, 2023 10:49 am
Forum: General discussion
Topic: 2 PWM output
Replies: 4
Views: 7214

Re: 2 PWM output

Hi, how can I set two (or more) different pwm-frequencys for two pwm-pins on STM32G071? I prefer analogWriteFrequency(herz), but I assume is only for all pwms - correct? analogWriteFrequency() is the easiest way. But it does not change frequency until analogWrite() i called and frequency changes on...
by GonzoG
Fri May 12, 2023 8:35 am
Forum: General discussion
Topic: No Port & Permission denied: macOS
Replies: 2
Views: 985

Re: No Port & Permission denied: macOS

F103 does not have hardware usb upload method. You need to flash usb bootloader first (using ST-Link or serial adapter).
Also it won't show bluepill's COM port until there's a sketch with USB CDC enabled flashed to it.
by GonzoG
Fri May 12, 2023 8:31 am
Forum: General discussion
Topic: BluePill fast 10 us Timer interrupt example code needed
Replies: 29
Views: 3904

Re: BluePill fast 10 us Timer interrupt example code needed

You don't need any additional libraries. Use hardware timer: https://github.com/stm32duino/Arduino_Core_STM32/wiki/HardwareTimer-library There's "Timebase_callback" example in stm32duino examples that does what you need. And if you want fast, set optimization to -O3 and use digitalWriteFas...
by GonzoG
Wed May 10, 2023 8:59 pm
Forum: General discussion
Topic: SIMPLE QUESTION BLUE PILL COMMUNICATIONS SETTINGS
Replies: 10
Views: 2190

Re: SIMPLE QUESTION BLUE PILL COMMUNICATIONS SETTINGS

You need a programmer to flash bootloader to F103 (ST-Link or usb-ttl). There is no other way. There are instructions how to flash HID bootloader.

hid_flash tool is for flashing your programs using HID bootloader.
by GonzoG
Wed May 10, 2023 10:24 am
Forum: General discussion
Topic: SIMPLE QUESTION BLUE PILL COMMUNICATIONS SETTINGS
Replies: 10
Views: 2190

Re: SIMPLE QUESTION BLUE PILL COMMUNICATIONS SETTINGS

You don't have HID bootloader on your board.
stm32duino bootloader is based on Maple bootloader and you need to select "Maple bootloader 2.0" or flash HID bootloader: https://github.com/Serasidis/STM32_HID_Bootloader

Go to advanced search