I am finding (as a previous forum user) that if I try to use PA15 as a GPIO, it does not work.
I am configuring PA15 the same way as other GPIO pins, enabling the pull up resistor, so that the pin can be shorted to ground to produce an input.
Measuring the voltage on the pin (strictly speaking pin 4 of the BW16 SoM) I see 1.6V, not the expected 3.3
It always reads 0 from the software
I then tried using it as an output - again, it settles at 1.6v regardless of whether I write 1 or 0 to it.
I notice from the UM401 datasheet for the RTL872XD chip in table 2.2 Low Power pins, that PA15 is an input for an external 32k oscillator, so I suspect that our problem arises because this function is ‘grabbing’ the pad.
I’m using the ameba-rtos-d SDK and my application uses FreeRTOS.
How can I disable the external 32k oscillator, and release PA15 (pin 4) of the BW16 for GPIO use?
Thanks in advance
Empirically, if I add an external 4.7k pull-up resistor to PA15, I find the standing voltage rises to about 2.2V.
This means that the pin is sinking approximately 0.2mA.
In this state, I can use it as a ‘wakeup pin’, but my use case cannot tolerate the increase in standby current (an extra 0.2mA).
Note that with the SoM powered down, if I use an ohm meter to measure between pin 4 and a power rail, there is no significant path ( values in Megohms), so there is some active electronics driving the pin to approximately half rail voltage.
Nosing around in the SDK, I found the following function
_LONG_CALL_ void EXT32K_Cmd(u32 NewStatus);
in ameba-rtos-d\component\soc\realtek\amebad\fwlib\include\rtl8721d_clk.h
I have tried calling it with the parameter DISABLED (which is #def’d to 0 in various places) but the pin continues to behave as described,
I have now tested PA15 using Arduino rather than the SDK.
PA15 is called Pin 9 in the Arduino world
I find that if I write a simple sketch which sets pinMode(9,OUTPUT); and toggling it slowly, I can see the pin changing from 0 to 3.3V and back.
So it is usable as an output.
However, if I now change it to 'pinMode(9,INPUT_PULLUP), I find that once again, the standing voltage on the pin is 1.6V.