RFM95 digital io to control mute on PAM8403 to get rid of hiss while receiving I am building a solution with an ESP32, a PAM8403 amp, a parallel TFT display, and a RFM95 LoRa module. All works great but I want to get rid of the noise that is generated when Lora is in receive mode.
I can do this by pulling pin 12 low on the PAM8403, which mutes all sound. However I have ran out of output pins on my ESP32, and it's too late to use a IO expander as the PCB has been built.
My initial idea was to use the RX/TX pins on the ESP32 when the unit was out of diagnostics mode. However if I can avoid this then that would be great. In my code when I issue Lora.sleep() / Lora.idle() the hissing goes away.
So I started to wonder if I could just trigger the mute function through another logic state that goes low when LoRa is idle and high when sleeping (allowing the mute to deactivate).
I am using the LoRa library by Sandeep Mistry, and I was wondering if I could use DIO1, DIO2, etc. as an IO PIN to control mute. If not, is it possible to use any of the already connected pins to behave in the desired way?
Thanks all in advance!
No, there is no way you can use the DIO pins to indicate sleep mode. They can only be set to indicate certain events, and sleep/idle is not one of them.
However the nRESET pin is optional, and you can use the setPins() function in the LoRa library to change which pin it's connected to - and one option is to set it to -1 in which case the library ignores it (this must be run before .begin() is called) as it's only used during begin() to initially reset the LoRa module.
You could either tie nRESET HIGH (to 3.3V) to never reset it, or couple it with the reset signal of another peripheral so it gets reset at the same time - just be careful with your initialisation order in this case so you don't reset the module after configuring it...