PiHPSDR V2.0.0-gpiod hand mic PTT and Encoder Push switch debounce issues resolution found
216 views
Skip to first unread message
K7MDL
unread,
Oct 2, 2021, 9:52:08 PM10/2/21
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Hermes-Lite
FYI - I opened a few new issues in the PiHPSDR github repository recently to report and track them. 2 of them I have resolved this week.
1. Local PTT (a hand mic in my case) no working, could not compile with that option set.
2. Encoder push switch debounce code missing
Details:
I am using a variety of normal hand and desk mics with my PiHPSDR controller V1 and V2 builds. One is a cheap speaker mic.
It does not seem like the PTT via GPIO logic was fully implemented yet. I added code in gpio.c to monitor the chosen line (pin 12 in my case) and mapped the action to MOX button along with some debounce logic. This has been working very well for me now. Further the keyword PTT is used in the Makefile to include the PTT feature, but also used in the actions list (actions.h and actions.c) causing a compile error. I renamed PTT top PTT_KEY in the actions lists and other places as required to resolve that. Mapping the PTT gpio event to MOX was a clean and easy way to handle PTT, can also use the toolbar MOX button at the same time.
I am using single encoders with push switches in a Controller V1 configuration. I found there was no debounce logic for them, only for the normal standalone switches. The encoder structures have the same switch state fields as the normal switches but the debounce code was missing for encoder switches. I cloned the normal switch debounce code and now they work. Changing the settle time from short to long (100 to 200ms) changes them from momentary to latching behavior. I think there is some code work still needed but it is working well enough for now.
I am still searching the PiHPSDR code for the logic that sends specific OC filter board data to the HL2, and the best place to insert HL2 one time configuration commands at startup. I was hoping to wedge in my Clk110MHz config commands at startup using that code as a template. I am using a python script for now.
- Mike
Sid Boyce
unread,
Oct 3, 2021, 7:25:32 AM10/3/21
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to herme...@googlegroups.com
I have 2 PiHPSDRv2 home built.
With this latest version (gpiod) I see switch problems, e.g XIT, MODE+
and BAND+ all act as MODE switches.
There were initial problems where the encoders didn't work but over the
weekend John disabled LOCALCW as suggested by Christoph.
Now the encoders are OK, the problem with switch mappings remain. That's
with the addition to /boot/config.txt
[all]
# setup GPIO for piHPSDR Controller 2
gpio=4-13,16-27=ip,pu
73 ... Sid.
--
Sid Boyce ... Hamradio License G3VBV, Licensed Private Pilot
Emeritus IBM/Amdahl Mainframes and Sun/Fujitsu Servers Tech Support
Senior Staff Specialist, Cricket Coach
Microsoft Windows Free Zone - Linux used for all Computing Tasks
Mike Lewis
unread,
Oct 3, 2021, 7:38:47 AM10/3/21
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
The encoders will not work if the pin assignments are duplicated, which they are by default in the mk2 V2 pcb template. The pin assignment conflict is hit, and the gpio monitor thread shuts down for all encoders on the error.
Easy fix, I have LOCALCW enabled, I just had to reassign the CWU and CWL gpio pins to once that did not conflict with the encoders. Since I use dual encoders with no push switches, the default switch pins 22,23,24, and 27 pins are unused. I made these CWU. CWL, Sidetone. IF you are using single encoders with switches, then use the 8 unused top encoder pins.
My solution was to modify the #defines in the top of the file gpio.c to make
Was:
int CWL_BUTTON=9;
int CWR_BUTTON=11;
int SIDETONE_GPIO=10;
Now:
int CWL_BUTTON=22;
int CWR_BUTTON=23;
int SIDETONE_GPIO=27;
recompile per the instructions in the WIKI. I made a bash script to perform those commands.
--
Sid Boyce ... Hamradio License G3VBV, Licensed Private Pilot Emeritus IBM/Amdahl Mainframes and Sun/Fujitsu Servers Tech Support Senior Staff Specialist, Cricket Coach Microsoft Windows Free Zone - Linux used for all Computing Tasks
--
You received this message because you are subscribed to the Google Groups "Hermes-Lite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hermes-lite...@googlegroups.com.
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Mike Lewis, Sid Boyce, herme...@googlegroups.com
To your switch mapping issues, sounds like some pin are shorted, maybe solder bridging at the MCP23017.
I built a black PCB MkII V2 board and have that configured at startup. All the non-encoders switches are off the MCP23017. Chances are good if some of your switches are working and not others, you need to look at the soldering on the MCP23017, the pins are rather close together. Also test the voltage at each switch, should be about 3.2V and ground when you push them.
I use "gpio readall" command to test the switches work. Just watch the BCM pin number for each switch and see that the status flips between 1 and 0 when you push and release each switch. You may need to update the gpio library, I had to on my new RPi 4B.
You can also use the "raspi-gpio get XX" where XX is your desired pin to watch. Once you know the hardware is right through this method, then you can look at software config. The file pihpsdr/gpio.props has pin numbers defined and I manipulate those to test things out. Once I get all working good I make a backup of that file.
--
Sid Boyce ... Hamradio License G3VBV, Licensed Private Pilot Emeritus IBM/Amdahl Mainframes and Sun/Fujitsu Servers Tech Support Senior Staff Specialist, Cricket Coach Microsoft Windows Free Zone - Linux used for all Computing Tasks
--
You received this message because you are subscribed to the Google Groups "Hermes-Lite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hermes-lite...@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Hermes-Lite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hermes-lite...@googlegroups.com.