Distinguishing Between P2-EC and P2-EC32MB Via Software
CJMJ
Posts: 226
What's the best [software] method for determining if a P2-EC vs a P2-EC32MB is being used? I have a mix of P2 edges and I'd like to determine via software which I'm using so I can turn off the correct LEDs.
PINLOW(56..57) 'P2-EC
PINLOW(38..39) 'P2-EC32MB
Comments
Perhaps query the psram?
DIP switch #1 disables the LEDs. Other than that, yeah, querying the RAM chips is a solid solution.
In the schematic for the P2-EC32MB board on page 3 there is a remark that one could use pin 57 to detect this board as there is a pullup on this pin (CE for PSRAM). I did not test it yet.
@evanh I didn't want to disable the LEDs with the DIP because I might want to use them for signalling. @VonSzarvas I was going to wait on exploring PSRAM but given your suggestion I've begun to look at the documentation. @Kaio good catch. I was looking at that sheet today and totally missed that tip. I've gone back and reviewed it but I'm still not sure how to use it (i.e. the tip) other than querying the PSRAM). Not really sure what "querying the PSRAM" means. Do I write a value and then read it back? If it doesn't come back then NO PSRAM. I did do a PINREAD on all 4 pins on both the P2-EC and the P2-EC32MB and they are always HIGH on start. So no differences there. I'll concentrate on the tip. Thanks for the suggestions.
One way to quite precisely measure the pull-up would be to use the ADC to measure the balance level between the pull-up resistor and the ADC's internal VIO/2 reference. You'd be able to identify the value of the resistor.
Another way would be to use two pull-down drive strengths, 150kR then 15kR, to detect a high then low logic input respectively.
Querying the RAM would be a case of requesting the chip ID or similar. Although, a write/read combo also works.
Just consider that sampling the resistor might only be reliable if your external circuit is known. Ie. an external "user" circuit attached to IO pin 57 could impact the resistance sample for a P2-EC module.
In the case that you have control of the external circuits, that resistor check is quick and easy.
Otherwise, attempting to read the chipID of the PSRAM was what I had in mind too. As that would only return the right value if an actual PSRAM if found (ie. P2-EC32MB).
ha! I suppose you could also add a 200K-470K pulldown on your breakout board at io57.
If a P2-EC is plugged in then P57 will be low, if a P2-EC32 is plugged in then P57 will be high.
Sure- that also depends on what P57 is used for in the case of P2-EC being installed.
By the same logic, you could add a specific external resistor to any of the P2-EC32MB ram specific pins.
@VonSzarvas No, that is not possible as those pins are not connected to the module contacts on the P2-EC32MB.
Exactly - use that !
Plug in the P2-EC and P57 will see the external pulldown
Plug in the P2-EC32MB and that pin is not connected, so you'll only see the internal pullup
Just make sure the external pulldown is suitably sized so as not to impact any potential external circuits.