RAK11720 PWM not working

Hello there,

Iam using the RAK11720 module and i want to pwm a motor. The pwm pin is connected to GP37 ( digital out) but it looks like pwm is only working with analog ADC pins. Is this correct or is it still possible to pwm with the GP37 (pin 27) ?

Kind regards,
Marnick

Hello @carlrowan or @beegee can you help me out with this problem? For my product i really need to have pwm working🙂

Kind regards,
Marnick

Are you using Low Power mode api.system.lpm.set(1);?
If yes, try to disable it api.system.lpm.set(0);

Regarding the usable pins, I can run PWM on GPIO44 (Green LED on WisBlock Base Board) when I disable low power mode.

Low Power mode is disabling GPIO’s, which means the PWM is not working anymore.

20240628_105938

@carlrowan run a test as well on a different pin and it doesn’t work.
It seems there are only certain pins possible.
However, I went through the Apollo3 datasheet and I couldn’t find any specific info about which pins can do PWM and which can’t.

Apollo3 Datasheet

1 Like

Thanks for your respond.

So this means gp37 cannot be used as a pwm signal? I tried before with an adc pin and this worked but i already made an pcb so this is not possible anymore and i need the adc for another functionality.

But is there a way to create a software controlled pwm signal instead of hardware? So yes, how can i implement this?

Kind regards,
Marnick

I don’t know any software PWM libraries.
It might be possible, but I guess it depends on the frequency you need for the PWM.

Well i dont need a real high frequency if i can start a motor in 20 steps in 3-5 seconds its enough. Do you have any idea of the max frequency i can use on the gp37 pin?

Hi @Marnick ,

I did some testing on IO1 to IO6.

These pins have PWM.

IO2 (GPIO4)
IO4 (GPIO31)
IO5 (GPIO12)

These DO NOT have PWM.

IO1 (GPIO38)
IO3 (GPIO37)
IO6 (GPIO36)

I’ve check the datasheet but it is hard to figure out what function/feature is blocking the PWM on those pins.

Hello @carlrowan

I manage to get hardware PWM for GPIO37, GPIO44, GPIO33 and GPIO13.
The only one that could be setup through Arduino API was the GPIO44. For the other three GPIOs I have to use really low level API of Ambiq SDK.

I think, that all GPIOs that can be connected to some sort of Timer output, may be used as PWM output. But a really few of them can actually be used with Arduino API.

Is there any reason why this limited capability?

Through my journey looking internal implementation of PWM mapping, I could get an Idea that this is not a such trivial task. Even though I couldn’t see any explicit reason why three of the four GPIOs that I tried to use, were not available with Arduino API.