RAKWireless / RAK-STM32-RUI

RUI3 BSP for RAK3172 modules
Other
26 stars 16 forks source link

Is it possible to use DAC with RAK-3172 module? #7

Closed happytm closed 9 months ago

happytm commented 1 year ago

Is it possible to use DAC (digital to analog converter) with RAK-3172 module usin pin number PA10? If So how to do it?

Thanks.

beegee-tokyo commented 9 months ago

PA10 is used as I2C2_SDA, but if you do not initialize the second I2C bus, analogRead(PA10); should work.

happytm commented 9 months ago

Thank you for your response.

Is it analogWrite(PA10) or analogRead(PA10)?

I wanted to use it for audio output.

beegee-tokyo commented 9 months ago

Sorry, I misunderstood. The PA10 can be configured as analog in or digital IO.

RUI3 does not support DAC on PA10. You need to use uhal/udrv functions to setup the pin for DAC.

If you use analogWrite(PA10, value), it will generate a PWM signal on the port, not a real analog value.

happytm commented 9 months ago

OK. Thank you.