Fixing Solenoid Control
AKA Check your pin types
While testing the solenoid control, I noticed that the GPIO would never go high to enable the high power MOSFET. While doing some digging I noticed on the datasheet that the pin type for the GPIO I used is Input Only
.
I once had an embedded systems professor recommend using a spreadsheet to keep track of all your IO that you are using, and to reference the datasheet for the microcontroller. You want to make sure you can actually use the pins you’ve selected for the things you want to do: Input, Output, ADC, SPI, UART, etc.
From the datasheet we can see that GPIO34 is not suitable for an output control signal:
Name | No | Type | Function |
---|---|---|---|
GND | 1 | P | Ground |
3V3 | 2 | P | Power Supply |
EN | 3 | I | Active High Enable |
SENSOR_VP | 4 | I | GPIO36 |
SENSOR_VN | 5 | I | GPIO39 |
IO34 | 6 | I | GPIO34 |
IO35 | 7 | I | GPIO35 |
IO32 | 8 | I/O | GPIO32 |
IO33 | 9 | I/O | GPIO33 |
I will need to change the GPIO pin for the solenoid control for the next boards, and for now run a small wire from the new pin to the current limiting resistor for the mosfet’s gate.