Search found 408 matches

by GonzoG
Sat May 20, 2023 10:04 pm
Forum: IDE's
Topic: Unable to upload a skect to STM32 Bluepill
Replies: 3
Views: 7980

Re: Unable to upload a skect to STM32 Bluepill

Blue pills usually do not have usb bootloader flashed. You need to do it yourself and for this you need ST-Link or USB-TTL adapter.
by GonzoG
Sun May 14, 2023 10:47 pm
Forum: General discussion
Topic: BluePill fast 10 us Timer interrupt example code needed
Replies: 29
Views: 4023

Re: BluePill fast 10 us Timer interrupt example code needed

digitalWriteFast/digitalReadFast need 1 MCU cycle. that would be very difficult to do. digitalWriteFast() calls digital_io_write(), which goes through a if..then statement before calling LL_GPIO_SetOutputPin(), which goes to a set of register writes. Hard to believe all that could be done in one cy...
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: 4023

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: 2371

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: 4023

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: 4023

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: 2371

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: 7878

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: 1052

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: 4023

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...

Go to advanced search