jrsteensen / OpenHornet

OpenHornet 1:1 F/A-18C Simulator Repository
https://www.openhornet.com
Other
315 stars 108 forks source link

AMPCD Controller IRQ PIN not Connected to IRQ Capable PIN on Pro-Micro #614

Open kbastronomics opened 1 year ago

kbastronomics commented 1 year ago

Summary:

The AMPCD Controller board is designed to use the IRQ pin of the TCA9554PWR to let us know when a switch is pressed, the PIN on the PRO-Micro though it's connected to is not IRQ Capable.

Expected Results/How It Should Work:

IRQ routine would be written so that when the any button is pressed a Interrupt is triggered and the software can read the TCA9554 to see which one it was.

Actual Results/How It Does Work:

Since the D6/A7 Pin is not IRQ capable you can not use a interrupt route and must poll the switches. Swapping PINS D6 with D8 would resolve this issue which also allows use of Pin Change Capture IRQ there would be no impact functionality but is a board change

Screenshots:

From the AMPCD COntroller showing the IRQ Pin.

image

From the PIN OUT of the PRO-Micro show that D6/A7 is not a IRQ capable pin

image

And from the datasheet

image

More Information

Category:

Check one or more items.

Associated Filename(s):

ddi_ampcd_controller

jrsteensen commented 1 year ago

Is this a breaking bug that prevent the AMPCD from working at all, or is it an enhancement to reduce overhead on the AMPCD?

kbastronomics commented 1 year ago

This prevents it from working as designed. It can be coded around.

The intent of the IRQ pin was to prevent the need to use polling of the buttons and instead the IRQ pins would let you know a button was pressed then you go check for which one.

Instead we'll have to POLL which means constantly checking for a button press and if found update DCS-BIOS

jrsteensen commented 1 year ago

Perfect, thank you. I'll save this one for the next major revision of the PCB in the future then. :)

Arribe commented 4 months ago

The current code's work around is to set IRQ pinmode to OUTPUT, which allows users to connect the IRQ pin according to the interconnect. An alternative workaround is to disconnect the IRQ pin connection on the controller PCB, then one could set the IRQ pinmode to INPUT.

Either way IRQ logic cannot be used until the hardware is updated. Though in practice DDI/AMPCDs do not appear to suffer any slowness / unresponsiveness caused by polling the 20 softkeys each loop.

kbastronomics commented 4 months ago

Need to identify why this happens and I suspect it's a issue on the DDI/AMPCD keyboard side not the controller side. even if the pin is connected, we should not need to change to output so there is a hardware issue not just the IRQ pin on the controller side needs to be on a IRQ capable pin.

IRQ's are about responding to events vs polling and either we do it everywhere or do it no-where
We should not use them in some places and not in others, this is a code consistency item.

The UFC for example does not show this same symptom. even with the AP Keypad attached.

Arribe commented 4 months ago

Aside from the UFC using an ESP32, the sample code from scuba also attaches the IRQ pin to use interrupt logic.