MicroSD Breakout

From linux-sunxi.org
Jump to navigation Jump to search
GND, GND, VDD, RX, TX
JTAG MicroSD UART-back.jpeg
JTAG MicroSD UART-side.jpeg

The cubieboard MicroSD breakout board provides JTAG and UART over the SD-Card connector. The UART connector is a 5 pin JST-XH.

Mapping

Pin MicroSD JTAG Connection 14-pin ARM JTAG Header UART Connection 5-pin UART Header
1 Data2 TCK 9 nc nc
2 CD/Data3 nc nc RX 2
3 Cmd TDO 11 nc nc
4 VDD VTG 1,13 VDD 3
5 CLK nc nc TX 1
6 VSS GND  2,4,6,8,10,14 GND 4, 5
7 Data0 TDI 5 nc nc
8 Data1 TMS 7 nc nc
nc nc nTRST 3 nc nc
nc nc nRESET 12 nc nc

U-Boot output to sdcard UART

For booting, apply the FEL/USBBoot procedure.

Mainline U-Boot

First, to setup u-boot for FEL mode, use <board>_felconfig instead of the usual <board>_defconfig.

Then, set in both

  • .config
  • spl/.conf
CONFIG_UART0_PORT_F=y

Alternatively, you can set the variables via menuconfig, but again you have to do this twice:

  • make menuconfig
  • make spl/menuconfig
ARM architecture  --->
[*] SPL/FEL mode support
[*]  UART0 on MicroSD breakout board

Compile as usual.

legacy u-boot-sunxi

Add 'UART0_PORT_F' to the option of the *_FEL line of your board in boards.cfg. Make sure it also contains 'SPL_FEL' instead of 'SPL'.

Linux kernel output to SD-Card UART

mainline kernel

It is necessary to delete the mmc0 entry from the dts file and also move uart0 pins from "PB22 and "PB23" to "PF2" and "PF4". This may look like adding something like this to the dts file (not the cleanest option):

	pio: pinctrl@01c20800 {
		uart0_pins_a: uart0@0 {
			allwinner,pins = "PF2", "PF4";
			allwinner,function = "uart0";
			allwinner,drive = <0>;
			allwinner,pull = <0>;
		};
	};

Legacy sunxi-3.4 kernel

Sunxi-3.4 kernel branch is deprecated and unsupported, information is here is stored for historical reasons.

Some FEX modifications are needed. An example for A13:

@@ -31,13 +31,13 @@ sdc_d2 = port:PF05<2><1><default><default>
 twi_port = 0
 twi_scl = port:PB00<2><1><default><default>
 twi_sda = port:PB01<2><1><default><default>
 
 [uart_para]
-uart_debug_port = 1
-uart_debug_tx = port:PG03<4><1><default><default>
-uart_debug_rx = port:PG04<4><1><default><default>
+uart_debug_port = 0
+uart_debug_tx = port:PF02<4><1><default><default>
+uart_debug_rx = port:PF04<4><1><default><default>
 
 [jtag_para]
 jtag_enable = 0
 jtag_ms = port:PF00<4><1><default><default>
 jtag_ck = port:PF05<4><1><default><default>
@@ -112,15 +112,15 @@ twi1_sda = port:PB16<2><default><default><default>
 twi2_used = 1
 twi2_scl = port:PB17<2><default><default><default>
 twi2_sda = port:PB18<2><default><default><default>
 
 [uart_para0]
-uart_used = 0
+uart_used = 1
 uart_port = 0
 uart_type = 2
-uart_tx = port:PB19<2><1><default><default>
-uart_rx = port:PB20<2><1><default><default>
+uart_tx = port:PF02<4><1><default><default>
+uart_rx = port:PF04<4><1><default><default>
 
 [uart_para1]
 uart_used = 1
 uart_port = 1
 uart_type = 2
@@ -351,11 +351,11 @@ csi_power_en_b =
 csi_stby_b =
 csi_flash_b =
 csi_af_en_b =
 
 [mmc0_para]
-sdc_used = 1
+sdc_used = 0
 sdc_detmode = 1
 bus_width = 4
 sdc_d1 = port:PF00<2><1><2><default>
 sdc_d0 = port:PF01<2><1><2><default>
 sdc_clk = port:PF02<2><1><2><default>

Breakout boards

See also

Buy

https://www.sparkfun.com/products/9419 - SparkFun microSD sniffer.