Microbit - Accessing GPIO Ring 0

Hi Community,

I'm playing around with the Microbit and wanted to direct PWM output to P0.02 instead of the internal speaker. I'm having an issue where the compiler is indicating p0_02 is an unknown field on on the Pins struct.

Using that same line in the microbit crate example project is giving me the error:

   |
   |             let mut speaker_pin = board.pins.p0_02.into_push_pull_output(gpio::Level::High);
   |                                              ^^^^^ unknown field
   |
help: a field with a similar name exists
   |
   |             let mut speaker_pin = board.pins.p0_01.into_push_pull_output(gpio::Level::High);
   |

Microbit documentation indicates RING 0 is accessed via P0.02 and I can see from the microbit crate documentation that p0_02 exists on the board.Pins struct.

I feel like I'm missing something obvious, however I'm very new to embedded programming. I've gone through the microbit book and wanted to start experimenting with my own audio based projects.

I think Microbit v2's P0.02 is board.edge.e00. It is defined here.

1 Like

Thank you, board.edge.e00 worked!

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.