CommunityGD32Cores / ArduinoCore-GD32

Arduino core for GD32 devices, community developed, based on original GigaDevice's core
Other
93 stars 33 forks source link

GD32F130C6 Tone and PWM doesn't work #66

Closed maxgerhardt closed 2 years ago

maxgerhardt commented 2 years ago

Per https://github.com/CommunityGD32Cores/platform-gd32/discussions/28.

No output when using provided standard code.

maxgerhardt commented 2 years ago

Fixed a criticial issue in https://github.com/CommunityGD32Cores/ArduinoCore-GD32/commit/6ba49c865388ff9dfc78f07e4e4d7f513631cb38 and it's workig on my GD32F190C6, but per discussion still no output on a real GD32F130, need to wait until realHW arrives.

djix123 commented 2 years ago

I have a GD32F130F8 to hand. Is there anything I can test?

maxgerhardt commented 2 years ago

If you can test the sketch

#include <Arduino.h>
PWM servo(PA0);

void captureCompareCallback(void);

void setup()
{
    pinMode(PB9, OUTPUT);

    // 1000Hz, 50% on-time.
    servo.setPeriodCycle(1000, 50, FORMAT_HZ);
    servo.attachInterrupt(captureCompareCallback);
    servo.start();
}

// the loop function runs over and over again forever
void loop() { }

// capture compare interrupt callback function
void captureCompareCallback(void)
{
    digitalToggle(PB9);
}

with platformio.ini

[env:genericGD32F130F8]
platform = https://github.com/CommunityGD32Cores/platform-gd32.git
board = genericGD32F130F8
framework = arduino

and see whether there is output on PA0 and/or PB9, that would be great. Make sure to use the CLI to pio platform update https://github.com/CommunityGD32Cores/platform-gd32.git before though.

djix123 commented 2 years ago

Yes, that works on a GD32F130F8. Changed PB9 to PB1 since PB9 isn't available on the GD32F130F8. See attached screenshot

Screen Shot 2022-06-05 at 8 39 22 AM

.

maxgerhardt commented 2 years ago

Confirmed fixed in discussion.