Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Jan 29, 2019 11:29:06 GMT
Have been fiddling with this for some hours .
I have added the microSD slot to the mini and trying to find out the needed resistors and capacitors. So far I compared the circuit to the Olimex A20 board and tried with and without resistors to no avail yet.
Progress so far:
R5606, R5608, R5609 and R5610 are pullup resistors to +3.3V R99 is the pullup for the card detect switch inside the slot. R98 is a pullup on the CMD line. R5611 is a series resistor (not a pullup) on the CLK line.
C208 and C979 are decoupling caps
With R5606, R5608, R5609 and R5610 placed as 47k reistors, R99 as a 10k and R98 as 10k and 100R for R5611 and a uSD card in the slot I can see quite some activity (with an oscilloscope) on the clock and data pin(s) when the mini starts up. Alas it notes in the boot messages that no MMC 2 is detected.
From within uboot I tried to set mmc to dev 0, dev 1 and dev 2 but no card detected. mmc rescan does nothing on the uSD pins.
If I remove the uSD card and start up the mini I only see very brief activity on the CLK line so it does make a difference if the card is inserted or not.
Anyone had any luck adding the uSD slot ?
|
|
|
Post by jj0 on Jan 29, 2019 19:03:07 GMT
Have been fiddling with this for some hours .
I have added the microSD slot to the mini and trying to find out the needed resistors and capacitors. So far I compared the circuit to the Olimex A20 board and tried with and without resistors to no avail yet.
Progress so far:
R5606, R5608, R5609 and R5610 are pullup resistors to +3.3V R99 is the pullup for the card detect switch inside the slot. R98 is a pullup on the CMD line. R5611 is a series resistor (not a pullup) on the CLK line.
C208 and C979 are decoupling caps
With R5606, R5608, R5609 and R5610 placed as 47k reistors, R99 as a 10k and R98 as 10k and 100R for R5611 and a uSD card in the slot I can see quite some activity (with an oscilloscope) on the clock and data pin(s) when the mini starts up. Alas it notes in the boot messages that no MMC 2 is detected.
From within uboot I tried to set mmc to dev 0, dev 1 and dev 2 but no card detected. mmc rescan does nothing on the uSD pins.
If I remove the uSD card and start up the mini I only see very brief activity on the CLK line so it does make a difference if the card is inserted or not.
Anyone had any luck adding the uSD slot ?
No, not yet. I had a friend add a ĹłSD slot but haven't done anything with the Rxxx yet. I read on the Discord channel that they could just be bridged but it looks like your experience is different. (edit) I assume you test this from the Mini's uboot? If you use FEL mode then you could play around with the [mmc0_para] settings in the script.bin: [mmc0_para] sdc_used = 1 sdc_detmode = 1 sdc_buswidth = 4 sdc_clk = port:PF02<2><1><2><default> sdc_cmd = port:PF03<2><1><2><default> sdc_d0 = port:PF01<2><1><2><default> sdc_d1 = port:PF00<2><1><2><default> sdc_d2 = port:PF05<2><1><2><default> sdc_d3 = port:PF04<2><1><2><default> sdc_det = port:PH01<0><1><default><default> sdc_use_wp = 0 sdc_wp = sdc_isio = 0 sdc_regulator = "none"
|
|
|
Post by ajatar on Feb 1, 2019 18:48:21 GMT
|
|
|
Post by ajatar on Feb 1, 2019 19:32:21 GMT
|
|
|
Post by crispin on Feb 2, 2019 21:53:03 GMT
|
|
|
Post by dobamuffin on Sept 19, 2021 15:37:08 GMT
First off, I didn't want to necro bump a forum post, but I felt like this was the best place to add my findings as I used the first post as a basis for installing the micro sd card slot. Have been fiddling with this for some hours . I have added the microSD slot to the mini and trying to find out the needed resistors and capacitors. So far I compared the circuit to the Olimex A20 board and tried with and without resistors to no avail yet. Progress so far: R5606, R5608, R5609 and R5610 are pullup resistors to +3.3V R99 is the pullup for the card detect switch inside the slot. R98 is a pullup on the CMD line. R5611 is a series resistor (not a pullup) on the CLK line. C208 and C979 are decoupling caps With R5606, R5608, R5609 and R5610 placed as 47k reistors, R99 as a 10k and R98 as 10k and 100R for R5611 and a uSD card in the slot I can see quite some activity (with an oscilloscope) on the clock and data pin(s) when the mini starts up. Alas it notes in the boot messages that no MMC 2 is detected.
From within uboot I tried to set mmc to dev 0, dev 1 and dev 2 but no card detected. mmc rescan does nothing on the uSD pins.
If I remove the uSD card and start up the mini I only see very brief activity on the CLK line so it does make a difference if the card is inserted or not. Anyone had any luck adding the uSD slot ? I installed the sd card slot and added in 100k resistors where you installed 47k, 10k resistors same as you, and shorted out R5611 instead of adding a series resistor. I also added in the necessary 10uf decoupling capacitors. Once that was complete, I inserted a micro SD card and as expected, there was no difference in dmesg accessed from uart. What I felt was relevant from the dmesg output is this:
[ 1.023140] [mmc-msg] SD/MMC/SDIO Host Controller Driver(mmc driver ver 2014-05-23 10:12) [ 1.023150] Compiled in Nov 26 2017 at 18:54:30 [ 1.023161] [mmc-msg] sw_mci_init [ 1.023196] [mmc-msg] get mmc0's sdc_f_max failed,use default sdc_f_max 50000000 [ 1.023208] [mmc-msg] get mmc0's sdc_f_ddr_max failed,use default sdc_f_ddr_max 47000000 [ 1.023220] [mmc-msg] get mmc0's sdc_ex_dly_used failed,use default dly [ 1.023251] [mmc-msg] get mmc3's sdc_f_max failed,use default sdc_f_max 50000000 [ 1.023263] [mmc-msg] get mmc3's sdc_f_ddr_max failed,use default sdc_f_ddr_max 0 [ 1.023274] [mmc-msg] get mmc3's sdc_ex_dly_used failed,use default dly [ 1.023286] [mmc-msg] MMC host used card: 0x9, boot card: 0x0, io_card 8 [ 1.024472] [mmc-msg] sdc0 set ios: clk 0Hz bm OD pm OFF vdd 3.3V width 1 timing LEGACY(SDR12) dt B [ 1.025548] [mmc-msg] sdc0 Probe: base:0xd081c000 irq:64 sg_cpu:ffdf7000(4bdc2000) ret 0. [ 1.026124] [mmc-msg] sdc3 set ios: clk 0Hz bm OD pm OFF vdd 3.3V width 1 timing LEGACY(SDR12) dt B [ 1.027200] [mmc-msg] sdc3 Probe: base:0xd081e000 irq:67 sg_cpu:ffdf6000(4bdc4000) ret 0.
It looks like uboot sees the intrerface, but the clk is set to 0Hz which makes it useless. Seems like uboot was setup like this. My idea is that they did this to stop the addition of an sd card for easy storage. Though that does not mean that the micro SD card slot is useless. I followed the digikey guide for the A20-OLinuXino Boards to get debian booting from SD card ( Post here). I did need to set CONFIG_MMC_BROKEN_CD=y in the defconfig, which was done by cloning the defconfig for the A20-ILinuXino-LIME, removing the configuration for the MMC CD pin, and adding in the config parameter for the broken card detect. This allowed me to boot the A20 processor from the micro sd card without giving me an error from the sd card not being detected (which is clearly not true as uboot was loaded off the sd card). The following was the bootup message
U-Boot SPL 2021.10-rc4-00016-gd0b8c9a231 (Sep 19 2021 - 09:53:23 -0400) DRAM: 256 MiB CPU: 912000000Hz, AXI/AHB/APB: 3/2/2 Trying to boot from MMC1
U-Boot 2021.10-rc4-00016-gd0b8c9a231 (Sep 19 2021 - 09:53:23 -0400) Allwinner Technology
CPU: Allwinner A20 (SUN7I) Model: Olimex A20-OLinuXino-LIME I2C: ready DRAM: 256 MiB MMC: mmc@1c0f000: 0 Loading Environment from FAT... Unable to use mmc 0:1... Unknown monitor Unknown monitor In: serial Out: serial Err: serial Net: Could not get PHY for ethernet@1c50000: addr 1 No ethernet found.
starting USB... Bus usb@1c14000: USB EHCI 1.00 Bus usb@1c14400: USB OHCI 1.0 Bus usb@1c1c000: USB EHCI 1.00 Bus usb@1c1c400: USB OHCI 1.0 scanning bus usb@1c14000 for devices... 1 USB Device(s) found scanning bus usb@1c14400 for devices... 1 USB Device(s) found scanning bus usb@1c1c000 for devices... 1 USB Device(s) found scanning bus usb@1c1c400 for devices... 1 USB Device(s) found scanning usb for storage devices... 0 Storage Device(s) found Hit any key to stop autoboot: 0 switch to partitions #0, OK mmc0 is current device Scanning mmc 0:1... Found /boot/extlinux/extlinux.conf Retrieving file: /boot/extlinux/extlinux.conf 149 bytes read in 2 ms (72.3 KiB/s) 1: Linux 5.X.Y-Z Retrieving file: /boot/vmlinuz-5.X.Y-Z 10600960 bytes read in 440 ms (23 MiB/s) append: root=/dev/mmcblk0p1 ro rootfstype=ext4 rootwait quiet Retrieving file: /boot/dtbs/5.X.Y-Z/sun7i-a20-olinuxino-lime.dtb 39412 bytes read in 8 ms (4.7 MiB/s) Kernel image @ 0x42000000 [ 0x000000 - 0xa1c200 ] ## Flattened Device Tree blob at 43000000 Booting using the fdt blob at 0x43000000 EHCI failed to shut down host controller. Loading Device Tree to 49f5c000, end 49f689f3 ... OK DE is present but not probed
Starting kernel ...
[ 0.005369] /cpus/cpu@0 missing clock-frequency property [ 0.005422] /cpus/cpu@1 missing clock-frequency property [ 1.250500] sun4i-usb-phy 1c13400.phy: Couldn't request ID GPIO [ 1.536681] ahci-sunxi 1c18000.sata: PHY power up failed. [ 8.283930] sun7i-dwmac 1c50000.ethernet eth0: no phy at addr -1 [ 8.303744] sun7i-dwmac 1c50000.ethernet eth0: stmmac_open: Cannot attach to PHY (error: -19)
Debian GNU/Linux 10 arm ttyS0
default username:password is [debian:temppwd]
It seems to work properly with both shell access from hdmi and UART.
I think if some effort put into why uboot is not utilizing the interface, we should be able to figure out why it is not working.
|
|
|
Post by jj0 on Sept 20, 2021 6:27:14 GMT
First off, I didn't want to necro bump a forum post, but I felt like this was the best place to add my findings as I used the first post as a basis for installing the micro sd card slot. Have been fiddling with this for some hours . I have added the microSD slot to the mini and trying to find out the needed resistors and capacitors. So far I compared the circuit to the Olimex A20 board and tried with and without resistors to no avail yet. Progress so far: R5606, R5608, R5609 and R5610 are pullup resistors to +3.3V R99 is the pullup for the card detect switch inside the slot. R98 is a pullup on the CMD line. R5611 is a series resistor (not a pullup) on the CLK line. C208 and C979 are decoupling caps With R5606, R5608, R5609 and R5610 placed as 47k reistors, R99 as a 10k and R98 as 10k and 100R for R5611 and a uSD card in the slot I can see quite some activity (with an oscilloscope) on the clock and data pin(s) when the mini starts up. Alas it notes in the boot messages that no MMC 2 is detected.
From within uboot I tried to set mmc to dev 0, dev 1 and dev 2 but no card detected. mmc rescan does nothing on the uSD pins.
If I remove the uSD card and start up the mini I only see very brief activity on the CLK line so it does make a difference if the card is inserted or not. Anyone had any luck adding the uSD slot ? I installed the sd card slot and added in 100k resistors where you installed 47k, 10k resistors same as you, and shorted out R5611 instead of adding a series resistor. I also added in the necessary 10uf decoupling capacitors. Once that was complete, I inserted a micro SD card and as expected, there was no difference in dmesg accessed from uart. What I felt was relevant from the dmesg output is this:
[ 1.023140] [mmc-msg] SD/MMC/SDIO Host Controller Driver(mmc driver ver 2014-05-23 10:12) [ 1.023150] Compiled in Nov 26 2017 at 18:54:30 [ 1.023161] [mmc-msg] sw_mci_init [ 1.023196] [mmc-msg] get mmc0's sdc_f_max failed,use default sdc_f_max 50000000 [ 1.023208] [mmc-msg] get mmc0's sdc_f_ddr_max failed,use default sdc_f_ddr_max 47000000 [ 1.023220] [mmc-msg] get mmc0's sdc_ex_dly_used failed,use default dly [ 1.023251] [mmc-msg] get mmc3's sdc_f_max failed,use default sdc_f_max 50000000 [ 1.023263] [mmc-msg] get mmc3's sdc_f_ddr_max failed,use default sdc_f_ddr_max 0 [ 1.023274] [mmc-msg] get mmc3's sdc_ex_dly_used failed,use default dly [ 1.023286] [mmc-msg] MMC host used card: 0x9, boot card: 0x0, io_card 8 [ 1.024472] [mmc-msg] sdc0 set ios: clk 0Hz bm OD pm OFF vdd 3.3V width 1 timing LEGACY(SDR12) dt B [ 1.025548] [mmc-msg] sdc0 Probe: base:0xd081c000 irq:64 sg_cpu:ffdf7000(4bdc2000) ret 0. [ 1.026124] [mmc-msg] sdc3 set ios: clk 0Hz bm OD pm OFF vdd 3.3V width 1 timing LEGACY(SDR12) dt B [ 1.027200] [mmc-msg] sdc3 Probe: base:0xd081e000 irq:67 sg_cpu:ffdf6000(4bdc4000) ret 0.
It looks like uboot sees the intrerface, but the clk is set to 0Hz which makes it useless. Seems like uboot was setup like this. My idea is that they did this to stop the addition of an sd card for easy storage. Though that does not mean that the micro SD card slot is useless. I followed the digikey guide for the A20-OLinuXino Boards to get debian booting from SD card ( Post here). I did need to set CONFIG_MMC_BROKEN_CD=y in the defconfig, which was done by cloning the defconfig for the A20-ILinuXino-LIME, removing the configuration for the MMC CD pin, and adding in the config parameter for the broken card detect. This allowed me to boot the A20 processor from the micro sd card without giving me an error from the sd card not being detected (which is clearly not true as uboot was loaded off the sd card). The following was the bootup message
U-Boot SPL 2021.10-rc4-00016-gd0b8c9a231 (Sep 19 2021 - 09:53:23 -0400) DRAM: 256 MiB CPU: 912000000Hz, AXI/AHB/APB: 3/2/2 Trying to boot from MMC1
U-Boot 2021.10-rc4-00016-gd0b8c9a231 (Sep 19 2021 - 09:53:23 -0400) Allwinner Technology
CPU: Allwinner A20 (SUN7I) Model: Olimex A20-OLinuXino-LIME I2C: ready DRAM: 256 MiB MMC: mmc@1c0f000: 0 Loading Environment from FAT... Unable to use mmc 0:1... Unknown monitor Unknown monitor In: serial Out: serial Err: serial Net: Could not get PHY for ethernet@1c50000: addr 1 No ethernet found.
starting USB... Bus usb@1c14000: USB EHCI 1.00 Bus usb@1c14400: USB OHCI 1.0 Bus usb@1c1c000: USB EHCI 1.00 Bus usb@1c1c400: USB OHCI 1.0 scanning bus usb@1c14000 for devices... 1 USB Device(s) found scanning bus usb@1c14400 for devices... 1 USB Device(s) found scanning bus usb@1c1c000 for devices... 1 USB Device(s) found scanning bus usb@1c1c400 for devices... 1 USB Device(s) found scanning usb for storage devices... 0 Storage Device(s) found Hit any key to stop autoboot: 0 switch to partitions #0, OK mmc0 is current device Scanning mmc 0:1... Found /boot/extlinux/extlinux.conf Retrieving file: /boot/extlinux/extlinux.conf 149 bytes read in 2 ms (72.3 KiB/s) 1: Linux 5.X.Y-Z Retrieving file: /boot/vmlinuz-5.X.Y-Z 10600960 bytes read in 440 ms (23 MiB/s) append: root=/dev/mmcblk0p1 ro rootfstype=ext4 rootwait quiet Retrieving file: /boot/dtbs/5.X.Y-Z/sun7i-a20-olinuxino-lime.dtb 39412 bytes read in 8 ms (4.7 MiB/s) Kernel image @ 0x42000000 [ 0x000000 - 0xa1c200 ] ## Flattened Device Tree blob at 43000000 Booting using the fdt blob at 0x43000000 EHCI failed to shut down host controller. Loading Device Tree to 49f5c000, end 49f689f3 ... OK DE is present but not probed
Starting kernel ...
[ 0.005369] /cpus/cpu@0 missing clock-frequency property [ 0.005422] /cpus/cpu@1 missing clock-frequency property [ 1.250500] sun4i-usb-phy 1c13400.phy: Couldn't request ID GPIO [ 1.536681] ahci-sunxi 1c18000.sata: PHY power up failed. [ 8.283930] sun7i-dwmac 1c50000.ethernet eth0: no phy at addr -1 [ 8.303744] sun7i-dwmac 1c50000.ethernet eth0: stmmac_open: Cannot attach to PHY (error: -19)
Debian GNU/Linux 10 arm ttyS0
default username:password is [debian:temppwd]
It seems to work properly with both shell access from hdmi and UART.
I think if some effort put into why uboot is not utilizing the interface, we should be able to figure out why it is not working.
This is rather interesting! So if I understand you correctly because the boot order is SD-card first and then NAND you can boot from SD-card. Changing the u-boot on the NAND is not trivial, as the source that RGL provided does not include the correct NAND driver so it's not just a matter of recompiling with the proper MMC settings enabled. Enabling it for the kernel on NAND might be slightly easier as it is governed by the script.bin settings. While that is on the NAND somewhere before nanda it might still be easier to change.
|
|
|
Post by spannernick on Sept 20, 2021 15:43:54 GMT
I feel RGL do things on purposes so it can not be use for anything else, like the way the maxi carousel only works on maxi/vic20, I wonder what state the A500 Mini will be in. So hopefully you be able to use a sd card on the mini then soon.. Good work.. , Once its all worked out a walk through will be need..
|
|
|
Post by spannernick on Sept 21, 2021 8:08:42 GMT
About a walk through, I do not mind making it if no one else can do it, it will need pictures as you are doing it too, if you have put the sd card on the board already then just use a picture of THEC64 Mini PCB without the sd card on it.
|
|
|
Post by dobamuffin on Sept 22, 2021 23:59:51 GMT
This is rather interesting! So if I understand you correctly because the boot order is SD-card first and then NAND you can boot from SD-card. Changing the u-boot on the NAND is not trivial, as the source that RGL provided does not include the correct NAND driver so it's not just a matter of recompiling with the proper MMC settings enabled. Enabling it for the kernel on NAND might be slightly easier as it is governed by the script.bin settings. While that is on the NAND somewhere before nanda it might still be easier to change. You are correct. It seems as though the Allwinner A20 is setup to boot from SD Card first and then boot from NAND.
About the nand driver, I understand what you are talking about. It seems the u-boot that I compiled also doesn't have the necessary drivers needed to load and see the nand chip, but it would be interesting if I could get that to work. If standard u-boot could be compiled to see and load the nand, then I guess a replacement u-boot could be created for these systems that resides on an sd card, and would take control of the system when inserted, that way no permanent changes are made to the nand, and it is easily reversable
I might have to see about the script.bin idea too as that sounds like another possibility. Though I'm not that good with all of this yet.
|
|
|
Post by dobamuffin on Sept 23, 2021 0:01:04 GMT
About a walk through, I do not mind making it if no one else can do it, it will need pictures as you are doing it too, if you have put the sd card on the board already then just use a picture of THEC64 Mini PCB without the sd card on it. I should be able to get some photos of my board when I get my 2nd ram chip in. I also want to expand the ram in my system, and I figure that would be the perfect time to document both the sd card install, and the ram install if it is successful (first time was not).
|
|
|
Post by jj0 on Sept 23, 2021 15:09:26 GMT
This is rather interesting! So if I understand you correctly because the boot order is SD-card first and then NAND you can boot from SD-card. Changing the u-boot on the NAND is not trivial, as the source that RGL provided does not include the correct NAND driver so it's not just a matter of recompiling with the proper MMC settings enabled. Enabling it for the kernel on NAND might be slightly easier as it is governed by the script.bin settings. While that is on the NAND somewhere before nanda it might still be easier to change. You are correct. It seems as though the Allwinner A20 is setup to boot from SD Card first and then boot from NAND.
About the nand driver, I understand what you are talking about. It seems the u-boot that I compiled also doesn't have the necessary drivers needed to load and see the nand chip, but it would be interesting if I could get that to work. If standard u-boot could be compiled to see and load the nand, then I guess a replacement u-boot could be created for these systems that resides on an sd card, and would take control of the system when inserted, that way no permanent changes are made to the nand, and it is easily reversable
I might have to see about the script.bin idea too as that sounds like another possibility. Though I'm not that good with all of this yet.
I guess the easiest way to achieve this would be to ignore the fact that there is already a kernel/initrd partition (nanda) and a rootfs partition (nandb) on an Allwinner/Sunxi partitioning scheme and activate the NAND as an empty MTD device in uboot, add the kernel/initrd and rootfs partitons back in and then you could use a standard uboot. Of course you would also need to add an MTD driver to the kernel (loaded in the initrd just like the nand driver currently is) but as the kernel source for the Mini is available that should be doable.
|
|
|
Post by dobamuffin on Sept 23, 2021 17:01:25 GMT
I guess the easiest way to achieve this would be to ignore the fact that there is already a kernel/initrd partition (nanda) and a rootfs partition (nandb) on an Allwinner/Sunxi partitioning scheme and activate the NAND as an empty MTD device in uboot, add the kernel/initrd and rootfs partitons back in and then you could use a standard uboot. Of course you would also need to add an MTD driver to the kernel (loaded in the initrd just like the nand driver currently is) but as the kernel source for the Mini is available that should be doable. If the mod is to be as simple as possible, I think the contents on the Nand partitions should be copied to the sd card so that it can boot from the sd card and give you full control of the system. Though this would require either nand access from the sd card u-boot or a script on the stock nand that backs it up so that a pc program could extract the necessary contents and insert them onto an sd card.
I think what I need to do is see what the different ways of going about this are, and then seeing which is the easiest, and which could be seen as the best. Already that people would have to solder in an sd card slot and appropriate resistors limits who is willing to do this mod, but if they go through all that effort, I want the rest to be as painless as possible.
|
|
|
Post by spannernick on Oct 1, 2021 11:07:42 GMT
I was mouldering, is there any difference in the 3 different PCB boards of THEC64 Mini, first model PAL with Toshiba Nand, Second Mode PAL with ESTM Nand and NTSC model with ATO Nand, is the sd card slots on them all the same...?
|
|
|
Post by dobamuffin on Oct 3, 2021 5:16:07 GMT
I was mouldering, is there any difference in the 3 different PCB boards of THEC64 Mini, first model PAL with Toshiba Nand, Second Mode PAL with ESTM Nand and NTSC model with ATO Nand, is the sd card slots on them all the same...? Not too sure. All I know is that the model I have had matching sd card circuits as a few other images I've seen.
|
|
|
Post by jj0 on Oct 3, 2021 15:02:53 GMT
I played around a bit with booting the Mini's kernel via FEL. When I use various script.bin settings: [target] storage_type = 1
[mmc0_para] sdc_used = 1 sdc_detmode = <X>
With <X> as: 1: GPIO detection - No MMC card recognised. 2: sdc_d3 detection - MMC card recognised but add/remove isn't recognised 3: Polling - MMC card recognised but add/remove isn't recognised There is no CONFIG_MMC_BROKEN_CD in the Mini's kernel source so that can't be used. <edit> I've created an SD-card image that allow you to boot the entire Mini system from SD-card, using: - A small FAT 1st partition with a nanda file (extracted from the Mini) and this script.bin (53.91 KB)
- An ext4 2nd partition with a nandb (extracted from the Mini) copied into it (using dd is easier to ensure the resulting filesystem doesn't contain features not supported by the Mini's kernel)
- U-Boot 2020.04 using:
make ARCH=arm Cubietruck_defconfig
And adding to the .config: CONFIG_MMC_BROKEN_CD=y CONFIG_ANDROID_BOOT_IMAGE=y
The following U-Boot environment variables:
kernel=nanda root=/dev/mmcblk0p2 script.bin=script.bin kernel_machid=0f35 C64Mini=setenv machid ${kernel_machid};setenv bootm_boot_mode sec;setenv bootargs ${ramfs} root=${root} console=ttyS0,115200 earlyprintk=ttyS0,115200 loglevel=9;load mmc 0:1 43000000 ${script.bin};load mmc 0:1 48000000 ${kernel};bootm 48000000 bootcmd=run C64Mini Note the ramfs variable is to make it easier to boot into the kernel's initrd ramdisk without mounting the SD-card, if you set it to 'ramfs' then you end up with a command prompt in the intitrd rootfs
|
|
|
Post by spannernick on Oct 3, 2021 18:15:51 GMT
So has the sd card been disabled then and made it hard to fix...?
and what image would this use, I could try and make one by coping nandb, could I test the image in my Cuubieboard2...?
|
|
|
Post by jj0 on Oct 3, 2021 18:55:27 GMT
So has the sd card been disabled then and made it hard to fix...? and what image would this use, I could try and make one by coping nandb, could I test the image in my Cuubieboard2...? Well it hasn't actually been disabled - the kernel supports it. But the card detection mode that is set in the script.bin settings is the one that doesn't actually works. This could be a leftover from the prototype they used, where it probably does work.
|
|
|
Post by dobamuffin on Oct 7, 2021 15:08:05 GMT
So has the sd card been disabled then and made it hard to fix...? and what image would this use, I could try and make one by coping nandb, could I test the image in my Cuubieboard2...? Well it hasn't actually been disabled - the kernel supports it. But the card detection mode that is set in the script.bin settings is the one that doesn't actually works. This could be a leftover from the prototype they used, where it probably does work. Yeah, I could not get the card detection working with the custom uboot either. Idk how they set it up in hardware, but it seems to be different than the dev boards they used.
|
|
|
Post by dobamuffin on Oct 7, 2021 15:11:05 GMT
I played around a bit with booting the Mini's kernel via FEL. When I use various script.bin settings: [target] storage_type = 1
[mmc0_para] sdc_used = 1 sdc_detmode = <X>
With <X> as: 1: GPIO detection - No MMC card recognised. 2: sdc_d3 detection - MMC card recognised but add/remove isn't recognised 3: Polling - MMC card recognised but add/remove isn't recognised There is no CONFIG_MMC_BROKEN_CD in the Mini's kernel source so that can't be used. <edit> I've created an SD-card image that allow you to boot the entire Mini system from SD-card, using: - A small FAT 1st partition with a nanda file (extracted from the Mini) and this View Attachment
- An ext4 2nd partition with a nandb (extracted from the Mini) copied into it (using dd is easier to ensure the resulting filesystem doesn't contain features not supported by the Mini's kernel)
- U-Boot 2020.04 using:
make ARCH=arm Cubietruck_defconfig
And adding to the .config: CONFIG_MMC_BROKEN_CD=y CONFIG_ANDROID_BOOT_IMAGE=y
The following U-Boot environment variables:
kernel=nanda root=/dev/mmcblk0p2 script.bin=script.bin kernel_machid=0f35 C64Mini=setenv machid ${kernel_machid};setenv bootm_boot_mode sec;setenv bootargs ${ramfs} root=${root} console=ttyS0,115200 earlyprintk=ttyS0,115200 loglevel=9;load mmc 0:1 43000000 ${script.bin};load mmc 0:1 48000000 ${kernel};bootm 48000000 bootcmd=run C64Mini Note the ramfs variable is to make it easier to boot into the kernel's initrd ramdisk without mounting the SD-card, if you set it to 'ramfs' then you end up with a command prompt in the intitrd rootfs
You definitely took this further than I was able to using uboot. Since I don't have much knowledge on the subject, I did a basic configuration as a proof of concept. If the entire system can be run off of the sd card, I guess that is a good start. If only das uboot had the necessary support for the nand chip. I may need to see about that.
|
|
|
Post by jj0 on Oct 22, 2021 18:41:47 GMT
I managed to change the script.bin section on the internal nand, enabling mmc0 and keeping mmc1 and mmc2 disabled. Dumping the script.bin keys from a running system shows that the changes are used:
========================================================= script_dump_mainkey: dump mmc0_para ========================================================= name: mmc0_para sub_key: name type value sdc_clk gpio (gpio: 139, mul: 2, pull 1, drv 2, data -1) sdc_cmd gpio (gpio: 140, mul: 2, pull 1, drv 2, data -1) sdc_d0 gpio (gpio: 138, mul: 2, pull 1, drv 2, data -1) sdc_d1 gpio (gpio: 137, mul: 2, pull 1, drv 2, data -1) sdc_d2 gpio (gpio: 142, mul: 2, pull 1, drv 2, data -1) sdc_d3 gpio (gpio: 141, mul: 2, pull 1, drv 2, data -1) sdc_det gpio (gpio: 168, mul: 0, pull 1, drv -1, data -1) sdc_detmode int 2 sdc_buswidth int 4 sdc_used int 1 sdc_use_wp int 0 sdc_wp INVALID TYPE sdc_isio int 0 sdc_regulator string "none" ========================================================= script_dump_mainkey: dump mmc1_para ========================================================= name: mmc1_para sub_key: name type value sdc_clk gpio (gpio: 149, mul: 2, pull 1, drv 2, data -1) sdc_cmd gpio (gpio: 150, mul: 2, pull 1, drv 2, data -1) sdc_d0 gpio (gpio: 151, mul: 2, pull 1, drv 2, data -1) sdc_d1 gpio (gpio: 152, mul: 2, pull 1, drv 2, data -1) sdc_d2 gpio (gpio: 153, mul: 2, pull 1, drv 2, data -1) sdc_d3 gpio (gpio: 154, mul: 2, pull 1, drv 2, data -1) sdc_used int 0 sdc_detmode int 4 sdc_buswidth int 4 sdc_det INVALID TYPE sdc_use_wp int 0 sdc_wp INVALID TYPE sdc_isio int 0 sdc_regulator string "none" ========================================================= script_dump_mainkey: dump mmc2_para ========================================================= name: mmc2_para sub_key: name type value sdc_cmd gpio (gpio: 60, mul: 3, pull 1, drv 2, data -1) sdc_clk gpio (gpio: 61, mul: 3, pull 1, drv 2, data -1) sdc_d0 gpio (gpio: 62, mul: 3, pull 1, drv 2, data -1) sdc_d1 gpio (gpio: 63, mul: 3, pull 1, drv 2, data -1) sdc_d2 gpio (gpio: 64, mul: 3, pull 1, drv 2, data -1) sdc_d3 gpio (gpio: 65, mul: 3, pull 1, drv 2, data -1) sdc_used int 0 sdc_detmode int 3 sdc_buswidth int 4 sdc_det INVALID TYPE sdc_use_wp int 0 sdc_wp INVALID TYPE sdc_isio int 0 sdc_regulator string "none"
The kernel sees /dev/mmcblk0* and can mount them. Same restrictions as in the FEL-mode, there is no notification of insertion/removal.
However the u-boot on nand (that uses the same script.bin) still doesn't see the nand. I'm not sure if it was compiled without mmc support, the mmc commands are available but don't see the mmc.
As the Mini boots from mmc first anyway if a bootable mmc is inserted it is not really an issue, more an interesting challenge to make it work from the internal u-boot as well.
|
|
|
Post by spannernick on Oct 27, 2021 18:32:30 GMT
I thought I would add this video here about How to solder a SD Card Slot on a PCB Board.
|
|
|
Post by dobamuffin on Nov 23, 2021 1:37:13 GMT
Finally got to opening my c64mini to get a better look at my mod.
I followed the digikey guide for the A20-OLinuXino Boards to get debian booting from SD card ( Post here). I did need to set CONFIG_MMC_BROKEN_CD=y in the defconfig, which was done by cloning the defconfig for the A20-ILinuXino-LIME, removing the configuration for the MMC CD pin, and adding in the config parameter for the broken card detect. This allowed me to boot the A20 processor from the micro sd card without giving me an error from the sd card not being detected (which is clearly not true as uboot was loaded off the sd card). Attachments:
|
|
|
Post by jj0 on Nov 23, 2021 11:25:20 GMT
So, now there are at least 2 people who can boot other OS's on their Mini ;-)
|
|
|
Post by c64stuff on Nov 24, 2021 3:16:07 GMT
I admit I haven't read the entity of this thread so this is probably a stupid question, but what's the point of adding a micro SD card? Is it just so you don't have a USB stick hanging off the unit, or is it because this mod allows you to bypass the flash firmware at boot?
|
|
|
Post by jj0 on Nov 24, 2021 6:24:09 GMT
I admit I haven't read the entity of this thread so this is probably a stupid question, but what's the point of adding a micro SD card? Is it just so you don't have a USB stick hanging off the unit, or is it because this mod allows you to bypass the flash firmware at boot? The latter.
|
|