VIM3 JTAG over sd-card adapter

Hi @tenk.wang @jasonl @goenjoy ,
after checking documentation of the VIM3[1] i concluded that JTAG is on the microsd pins.
i flashed my android image and tried to attach my olimex jtag adapter via an selfmade adapter

the pinout i tried is (sdcard from top to bottom 1 -8)

3 → TMS
5-> CLK
6->GND
7->TDO
8->TDI

I don’t have much experience with JTAG do i miss something here? openocd tries autoprobing so i don’t know if my conclusion is right. Has anybody more information?

Thanks a lot!

[1] schematics VIM3

Hi @ickyphuz maybe you should check the jtag driver first,you can look something about jtag in common/arch/arm/boot/dts/amlogic/mesong12b.dtsi file

Hi @jasonl thanks for coming back to me.
So i checked the arch64/boot/dts folder and noticed that for the amlogic tree there is no specified jtag
i greped for jtag and found an example from rockchip which exposes jtag over the sdcard.
So i guess the reason i don’t get any jtag is not because of my pinout, it’s because it’s not “active” or configured as jtag.

could i use something like that i got from the rk3399-gru.dtsi with adapted parameters?

513 &sdmmc {
514         status = "okay";
515 
516         /*
517          * Note: configure "sdmmc_cd" as card detect even though it's actually
518          * hooked to ground.  Because we specified "cd-gpios" below dw_mmc
519          * should be ignoring card detect anyway.  Specifying the pin as
520          * sdmmc_cd means that even if you've got GRF_SOC_CON7[12] (force_jtag)
521          * turned on that the system will still make sure the port is
522          * configured as SDMMC and not JTAG.
523          */
524         pinctrl-names = "default";
525         pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_cd_gpio
526                      &sdmmc_bus4>;
527 
528         bus-width = <4>;
529         cap-mmc-highspeed;
530         cap-sd-highspeed;
531         cd-gpios = <&gpio4 24 GPIO_ACTIVE_LOW>;
532         disable-wp;
533         sd-uhs-sdr12;
534         sd-uhs-sdr25;
535         sd-uhs-sdr50;
536         sd-uhs-sdr104;
537         vmmc-supply = <&pp3000_sd_slot>;
538         vqmmc-supply = <&ppvar_sd_card_io>;
539 };

or is it not possible? i made kgdb working but it would be better to have jtag debug capabilities.
Thank’s for your help!

EDIT: so in the meson-khadas-vim3.dtsi i found the &sd_emmc_b section where GPIOC_6 is pulled low
judging from the documentation “GPIOC_6 should not pulled low if GPIOC is not work as SDCARD”

i added this section to the khadas vim3*-*.dts files

102 &sd_emmc_b {
103          status = "okay";
104          pinctrl-0 = <&sdcard_c_pins>;
105          pinctrl-1 = <&sdcard_clk_gate_c_pins>;
106          pinctrl-names = "default", "clk-gate";
107 
108          bus-width = <4>;
109          cap-sd-highspeed;
110          max-frequency = <50000000>;
111          disable-wp;
112 
113          /*cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>; */
114          vmmc-supply = <&vsys_3v3>;
115          vqmmc-supply = <&vsys_3v3>;
116  };

but it did not make any difference at all

you are using android 12 firmware ? if true ,you can ask @tenk.wang

yes, i build AOSP 12 with kernels 4.19, 5.4, 5.10 and 5.15 @tenk.wang do you have some ideas?
thanks a lot!

@ickyphuz Did you success JTAG connection?
Could you share result in the end?

@ickyphuz It may not be related to this topic. Can you please how did you make KGDB working in vim3? I tried to add polling support to the meson uart (amlogic) still kgdboc says no polling driver (added logs myself).