zephyr.js icon indicating copy to clipboard operation
zephyr.js copied to clipboard

Figure out exactly what's what on A101

Open grgustaf opened this issue 9 years ago • 2 comments
trafficstars

We need to make sure we understand the external pin features of A101 more precisely. The comments on boards/arduino_101/pinmux.c seem to include everything we need to know, but we need to make sure we understand those things right.

For example, the AIO pins we've exposed so far are ain_9 - ain_14 there, aka AD5, AD0-AD4. But pins IO10-13 are also listed as ain_0 - ain_3... so does that mean they can also be analog inputs? Perhaps only from the ARC side? We need to set up some code to test out all these things and prove it to ourselves.

grgustaf avatar Jul 18 '16 17:07 grgustaf

I did write some test code to help with this, but it was too painful to write against the new promise-based GPIO API so I wrote it against an older version. If we do revert that change, I could check in my test code.

Anyway, by testing all GPIO numbers up to 31 or 63 or something, I found that IO2-5,7-8,10-13 work as inputs, but only IO2,4,7-8,10-13 work as outputs. I also found that GPIO 26 is a red fault LED we can use. (We already knew 8 and 12 were green LEDs.)

I also learned that the x86 can perform an "analog comparator" function. Apparently on some chips this can mean comparing two pins for relative analog voltage, but in the case of this x86 chip seems to mean compare a pin against a single configured analog voltage. (So e.g. it can return 1 if it's over 2.8V, 0 otherwise.) So we could probably try out and provide a web API for that feature, and it's a feature of the x86 core. From Zephyr docs it appears that it would work on many of the Arduino pins.

The ARC core on the other hand is what has an ADC, to convert an analog value into a digital value, and I believe that is only connected to A0-A5, which we already support.

grgustaf avatar Aug 03 '16 22:08 grgustaf

There is also some trickery around I2C, I remember. Looking at pinmux I see this:

107 * 1. I2C pins on the shield are connected to i2c0_ss_sda and i2c_0_ss_scl, 108 * which are on the sensor subsystem. They are also tied to AD4 and AD5. 109 * Therefore, to use I2C, pin 9 (ain_9) and (ain_14) both need to be set 110 * to PINMUX_FUNC_B, so they will not interfere with I2C operations. 111 * Also, there is no internal pull-up on I2c bus, and thus external 112 * pull-up resistors are needed.

kenchris avatar Aug 10 '16 13:08 kenchris