07-20-2017, 04:56 PM
(This post was last modified: 10-11-2017, 04:49 AM by MarkHaysHarris777.)
This is my first experiment with bringing some of the A64 gpio mux lines to the outside via the SD card slot; SDIO. These are data lines D0-D3, CMD, CLK, VDD, & VSS. The lines are gpio160 - gpio166; PF0 - PF6.
The pic above is the 48cm ribbon cable that extends the SD micro slot to a full size card adapter; this ribbon is useful in itself; but I plan to modify it for pin access on a solderable bread-board.
These two shots are the modified ribbon cable; this was actually easier than I expected. The cable will extend under the notebook.
The two shots above show the finished cable running; I have the green and red LED(s) initially connected to CMD and CLK. These are pulsing at regular 3/4 second intervals (or so). The gpio(s) are not useful in this state; next I need to hack the dts and make sure that the pin function register has '0' s.
Please see this important link:
marcushh777
please join us for a chat @ irc.pine64.xyz:6667 or ssl irc.pine64.xyz:6697
( I regret that I am not able to respond to personal messages; let's meet on irc! )
(07-20-2017, 04:56 PM)MarkHaysHarris777 Wrote: This is my first experiment with bringing some of the A64 gpio mux lines to the outside via the SD card slot; SDIO. These are data lines D0-D3, CMD, CLK, VDD, & VSS. The lines are gpio160 - gpio166; PF0 - PF6.
The pic above is the 48cm ribbon cable that extends the SD micro slot to a full size card adapter; this ribbon is useful in itself; but I plan to modify it for pin access on a solderable bread-board.
These two shots are the modified ribbon cable; this was actually easier than I expected. The cable will extend under the notebook.
The two shots above show the finished cable running; I have the green and red LED(s) initially connected to CMD and CLK. These are pulsing at regular 3/4 second intervals (or so). The gpio(s) are not useful in this state; next I need to hack the dts and make sure that the pin function register has '0' s.
Stay tuned.
Awesome
07-22-2017, 07:44 AM
(This post was last modified: 07-22-2017, 08:42 AM by MarkHaysHarris777.)
This post is just to document the placement of the pins on my breakout with the extender; the Sparkfun breakout board ( coming soon ) has a slightly different layout.
Code: Pin SD SPI
PF5 D2 X
PF4 D3 CS
PF3 CMD DI
+ VDD VDD
PF2 CLK SCLK
PF1 D0 DO
PF0 D1 X
- VSS VSS
Note: Vss in the pic above (ground) is normally the third pin up from the bottom, between D0 and CLK. I moved Vss physically to create two logical groups of three pins PF0-2 and PF3-5; this also allows for good separation between Vdd and Vss.
Note: See schematic pp 9; T-card/USB
marcushh777
please join us for a chat @ irc.pine64.xyz:6667 or ssl irc.pine64.xyz:6697
( I regret that I am not able to respond to personal messages; let's meet on irc! )
07-22-2017, 02:02 PM
(This post was last modified: 08-15-2017, 03:37 PM by MarkHaysHarris777.)
The above pics are option (2); the model from Sparkfun is a little more expensive, but arrived in two days. The Chinese version will be here in 30 days from Shenzhen (if I'm lucky with customs). These plug directly into the micro SD slot (although its a little tricky, I did have to use the dremel tool). The layout is similar but different; in this model the Vss and Vdd are together in the center.
Again, we have tapped the gpio(s) after mounting header pins on the sniffer card; the sniffer card is designed to be a logic test point for logic analyzer. I won't be pushing an SD card in the slot but will experiment with the gpio(s) using this direct interface.
Note: pin (CD) is card-detect ; also D3.
marcushh777
please join us for a chat @ irc.pine64.xyz:6667 or ssl irc.pine64.xyz:6697
( I regret that I am not able to respond to personal messages; let's meet on irc! )
07-22-2017, 04:17 PM
(This post was last modified: 07-22-2017, 04:20 PM by MarkHaysHarris777.)
By disabling the sdmmc for sdc0, and setting sdc0 to function gpio_in, muxsel 0x0, drive 0x0, (pinctrl and bindings) I have been able to set gpio160 - gpio165 ( PF0 - PF5 ) to ON | OFF with the sysfs method:
echo 160 > export
echo out > gpio160/direction
echo 1 > gpio160/value
echo 0 > gpio160/value
After bootup the gpio(s) were in default input (cmd and clk no longer strobing); all six gpio(s) were successfully exported, defined, and set ON|OFF. In the left pic above the right LED is Vdd monitor while the left LED is monitoring gpio160 which has just been set ON. In the right pic the gpio160 has been set OFF; Vdd still indicating 3v3 rail.
Note: the dts|dtb is static atm; will want to configure so that uEnv.txt controls dtb "on-the-fly" via variable.
Note: the SD card slot can be raw gpio(s) ; or SD card external storage ; or SPI (jtag, other)
Note: All of this assumes ofc that the pinebook is booted via eMMC; SD card slot is disabled for external storage
Note: option (2) sniffer adapter is less than expected; sloppy in the slot and difficult to control; the card needs to be just a tad thicker, and the latching mechanism needs to be better defined; may have to make our own cards !
marcushh777
please join us for a chat @ irc.pine64.xyz:6667 or ssl irc.pine64.xyz:6697
( I regret that I am not able to respond to personal messages; let's meet on irc! )
07-23-2017, 04:14 AM
(This post was last modified: 07-23-2017, 08:07 AM by MarkHaysHarris777.)
The purpose of this post is to document the changes I made to the dts; these changes are experimental and may not be entirely correct. Do not copy these changes; or do so at your own risk. These changes are static (I recompiled the dtb and the changes do not modify on-the-fly).
The dts is decompiled from the ayufan image 0.7.3 using dtc device-tree-compiler. I made three sets of changes; each will be listed in its own code block with line numbers. Essentially the changes disable the sdmmc for @sdc0 and set the bindings (may not be correct) for @sdc0 gpio(s) PF0 - PF5.
The changes are listed in the order they appear in the source:
When I make changes to my experimental dts, I will update these code blocks to reflect the most recent revision; the following is the second revision.
[change 1]
Code: [old source 1]
948 sdc0@1 {
949 allwinner,pins = "PF0", "PF1", "PF2", "PF3" , "PF4", "PF5";
950 allwinner,function = "io_disabled";
951 allwinner,muxsel = <0x7>;
952 allwinner,drive = <0x1>;
953 allwinner,pull = <0x1>;
954 linux,phandle = <0x64>;
955 phandle = <0x64>;
956 };
[new change 1] 950, 951, 953
948 sdc0@1 {
949 allwinner,pins = "PF0", "PF1", "PF2", "PF3" , "PF4", "PF5";
950 allwinner,function = "gpio_in";
951 allwinner,muxsel = <0x0>;
952 allwinner,drive = <0x0>;
953 allwinner,pull = <0x1>;
954 linux,phandle = <0x64>;
955 phandle = <0x64>;
956 };
[change 2]
Code: [old source 2]
1554 sdc0@0 {
1555 linux,phandle = <0xc0>;
1556 phandle = <0xc0>;
1557 allwinner,pins = "PF0", "PF1", "PF2", "PF3" , "PF4", "PF5";
1558 allwinner,function = "sdc0";
1559 allwinner,pname = "sdc0_d1", "sdc0_d0", "sd c0_clk", "sdc0_cmd", "sdc0_d3", "sdc0_d2";
1560 allwinner,muxsel = <0x2>;
1561 allwinner,pull = <0x1>;
1562 allwinner,drive = <0x2>;
1563 allwinner,data = <0xffffffff>;
1564 };
[new change 2] 1560, 1562
1554 sdc0@0 {
1555 linux,phandle = <0xc0>;
1556 phandle = <0xc0>;
1557 allwinner,pins = "PF0", "PF1", "PF2", "PF3" , "PF4", "PF5";
1558 allwinner,function = "sdc0";
1559 allwinner,pname = "sdc0_d1", "sdc0_d0", "sd c0_clk", "sdc0_cmd", "sdc0_d3", "sdc0_d2";
1560 allwinner,muxsel = <0x0>;
1561 allwinner,pull = <0x1>;
1562 allwinner,drive = <0x0>;
1563 allwinner,data = <0xffffffff>;
1564 };
[change 3]
Code: [old source 3]
2169 sdmmc@01c0f000 {
2170 compatible = "allwinner,sun50i-sdmmc0";
2171 device_type = "sdc0";
2172 reg = <0x0 0x1c0f000 0x0 0x1000>;
2173 interrupts = <0x0 0x3c 0x104>;
2174 clocks = <0x6 0x5a 0x60 0x61 0x62>;
2175 clock-names = "osc24m", "pll_periph", "mmc", "ahb", "rst";
2176 pinctrl-names = "default", "sleep";
2177 pinctrl-1 = <0x64>;
2178 max-frequency = <0x2faf080>;
2179 bus-width = <0x4>;
2180 broken-cd;
2181 status = "okay";
2182 pinctrl-0 = <0xc0>;
2183 cd-gpios = <0x30 0x5 0x6 0x0 0x1 0x2 0xffffffff>;
2184 sunxi-power-save-mode;
2185 vmmc = "vcc-sdcv";
2186 vqmmc = "vcc-sdcvq33";
2187 vdmmc = "vcc-sdc";
2188 };
[new change 3] 2181
2169 sdmmc@01c0f000 {
2170 compatible = "allwinner,sun50i-sdmmc0";
2171 device_type = "sdc0";
2172 reg = <0x0 0x1c0f000 0x0 0x1000>;
2173 interrupts = <0x0 0x3c 0x104>;
2174 clocks = <0x6 0x5a 0x60 0x61 0x62>;
2175 clock-names = "osc24m", "pll_periph", "mmc", "ahb", "rst";
2176 pinctrl-names = "default", "sleep";
2177 pinctrl-1 = <0x64>;
2178 max-frequency = <0x2faf080>;
2179 bus-width = <0x4>;
2180 broken-cd;
2181 status = "disabled";
2182 pinctrl-0 = <0xc0>;
2183 cd-gpios = <0x30 0x5 0x6 0x0 0x1 0x2 0xffffffff>;
2184 sunxi-power-save-mode;
2185 vmmc = "vcc-sdcv";
2186 vqmmc = "vcc-sdcvq33";
2187 vdmmc = "vcc-sdc";
2188 };
Note: Line numbers following [new change X] indicate specific changed lines.
Note: The original source may be compared with the changed source in each code block.
marcushh777
please join us for a chat @ irc.pine64.xyz:6667 or ssl irc.pine64.xyz:6697
( I regret that I am not able to respond to personal messages; let's meet on irc! )
07-23-2017, 06:27 AM
(This post was last modified: 07-23-2017, 08:58 AM by MarkHaysHarris777.)
My first clue that the bindings may not be entirely correct is that inputs with active_low=1 don't work. By default when I setup an input (used PF4 and PF5) then active_low=0 ; which means the default state of the pin is zero and it becomes active 'high'; this works ! Set the pin to 3v3 and its value becomes 1.
On the other hand, if I set active_low=1 then the input pin does not work; its value remains default '1' regardless of grounding the pin ( setting it to low zero ). So, I suspect I need to revisit 'pull' and 'drive' and fix whatever I don't understand there.
Note: ofc an external pullup of 56K ohms works fine to invert the behavior of the input
Note: regardless, we have both input and output working with gpio block @sdc0 ( PF0 - PF5 ) gpio160 - gpio165.
Note: need to make the dts generic ; and get the C and Python routines working.
marcushh777
please join us for a chat @ irc.pine64.xyz:6667 or ssl irc.pine64.xyz:6697
( I regret that I am not able to respond to personal messages; let's meet on irc! )
Thanks on the GPIO over SD slot post. Now the Pinebook also has GPIO access :-)
(07-22-2017, 02:02 PM)MarkHaysHarris777 Wrote:
The above pics are option (2); the model from Sparkfun is a little more expensive, but arrived in two days. The Chinese version will be here in 30 days from Shenzhen (if I'm lucky with customs). These plug directly into the micro SD slot (although its a little tricky, I did have to use the dremel tool). The layout is similar but different; in this model the Vss and Vdd are together in the center.
Again, we have tapped the gpio(s) after mounting header pins on the sniffer card; the sniffer card is designed to be a logic test point for logic analyzer. I won't be pushing an SD card in the slot but will experiment with the gpio(s) using this direct interface.
Note: pin (CD) is card-detect ; also D3.
hi, good thread. wanted to mention that sparkfun also has this sd card sniffer.
https://www.sparkfun.com/products/11468
also, if you are not aware some vendors will also ship from hong kong by request.
i have been getting hk stuff much faster.
08-15-2017, 03:44 PM
(This post was last modified: 08-15-2017, 03:45 PM by MarkHaysHarris777.)
(07-22-2017, 02:02 PM)MarkHaysHarris777 Wrote:
The above pics are option (2); the model from Sparkfun is a little more expensive, but arrived in two days. The Chinese version will be here in 30 days from Shenzhen (if I'm lucky with customs). These plug directly into the micro SD slot (although its a little tricky, I did have to use the dremel tool). The layout is similar but different; in this model the Vss and Vdd are together in the center.
Again, we have tapped the gpio(s) after mounting header pins on the sniffer card; the sniffer card is designed to be a logic test point for logic analyzer. I won't be pushing an SD card in the slot but will experiment with the gpio(s) using this direct interface.
Note: pin (CD) is card-detect ; also D3.
hi again, well, the RED card options ( microSD Sniffer , see post #4) one from Sparkfun , and one from the market in Shenzhen are a bust; the model from Shenzhen does not work at all ( way too thick ) and the one from Sparkfun is loose and sloopy ( although it does work ) because its way too thin.
The card must be the same size and shape as the micro SD card ; doh. Specifically the card must not be any thicker than .75mm and the one from Shenzhen is 1.0mm, the one from Sparkfun is less than .50mm. If I am very careful I can make the Sparkfun model work; but what a pain. So, I'm down to using only the microSD extension cables, which work very well.
There are many vendors for this card; I plan to try to make my own card and not waste any more money are cheap gimmicks.
marcushh777
please join us for a chat @ irc.pine64.xyz:6667 or ssl irc.pine64.xyz:6697
( I regret that I am not able to respond to personal messages; let's meet on irc! )
|