lowRISC / opentitan

OpenTitan: Open source silicon root of trust
https://www.opentitan.org
Apache License 2.0
2.58k stars 777 forks source link

[fpga] CW310: Utilizing `USRSW0` & `USRSW1` pushbuttons in SW #17331

Closed L0g4n closed 1 year ago

L0g4n commented 1 year ago

Description

Hello there,

CW310 has three user push buttons: SW0 (which is used for reset in the firmware), SW1, SW2. I want to use them trough the pinmux in SW for requesting user presence (welp, not directly through the pinmux but rather atop the abstractions TockOS provides).

However, the pin layout suggests that only USRSW0 is mapped, which is referred to as POR_BUTTON_N and subsequently can be found in the pinout table under its respective name.

Does that mean that the other ones are (currently) not accessible from SW?

Cheers

a-will commented 1 year ago

CW310 has three user push buttons: SW0 (which is used for reset in the firmware), SW1, SW2. I want to use them trough the pinmux in SW for requesting user presence (welp, not directly through the pinmux but rather atop the abstractions TockOS provides).

However, the pin layout suggests that only USRSW0 is mapped, which is referred to as _POR_BUTTONN and subsequently can be found in the pinout table under its respective name.

Does that mean that the other ones are (currently) not accessible from SW?

That's correct. I think our primary focus with the CW310 has been to run automated tests against an emulated Earl Grey ASIC, rather than connect the SoC to take advantage of all the interactive features of the board (though in this variant of the pin-out, the DIP switches and LEDs did get connected for demo purposes).

If you have the necessary Vivado license to build the bitstream, you could modify the pin-out for your own use case, however. For example, you might choose to take IOR5 away from the DIP switch and route it to one of the remaining two push buttons.

It's admittedly not very ergonomic, but an alternative would be to merely use the DIP switch, if you wanted to proceed with no changes to the hardware.

L0g4n commented 1 year ago

Thanks for the clarification. Unfortunately, I don't have a Vivado license, and thus can't build the bitstream myself. I am not sure if I can use a DIP switch from Tock, but I will evaluate my options.

a-will commented 1 year ago

Thanks for the clarification. Unfortunately, I don't have a Vivado license, and thus can't build the bitstream myself. I am not sure if I can use a DIP switch from Tock, but I will evaluate my options.

The DIP switch can be used as a GPIO, like it is in our demos and just like you would do for a push button, right? Unlike the push button, though, human presence couldn't be detected by the logic level from the switch, since it doesn't automatically snap back to its original level. Instead, you might want to use edges (i.e. the act of flipping the switch would indicate presence, so a positive / negative edge would be equivalent to pushing a button down).

L0g4n commented 1 year ago

Instead, you might want to use edges (i.e. the act of flipping the switch would indicate presence, so a positive / negative edge would be equivalent to pushing a button down).

Was actually thinking about that myself, that should work :) Not ideal but better than nothing.

Thanks!