PWM set as open drain

23 Nov 2011

I can not set the PWM as open drain.

I made my own PwmOut.h file with this line in the public area.

void mode(PinMode pull);

Does not work. (message error: " Undefined symbol mbed::PwmOut::mode(PinMode) (referred from main.cpp.cpp.LPC1768.o)."

Please advice,

Frank

24 Nov 2011

Thanks Cristian,

I tried that it didn't work.

I also tried the following without success: Configured the pin with DigitalInOut for the GPIO part. And I drive it with PwmOut. No need to modify the .h files.

main.cpp:

  1. include "mbed.h"

PwmOut ctrl(P2_5); DigitalInOut ctrl_conf(P2_5);

int main() { ctrl_conf.input(); ctrl_conf.mode(OpenDrain); ctrl=0.5;

After reading the UM and datasheet, I get the feeling that it is not possible to use PWM with open drain. There is no block diagram that shows how the GPIO and PWM are interconnected.

Perhaps the motor_pwm could be open drain. But that seems rather complicated, no examples available.

Best regards, Frank