Odroid N1 SPI Boot flash

Moderators: mdrjr, odroid

Re: Odroid N1 SPI Boot flash

Unread postby crashoverride » Mon Mar 12, 2018 4:45 pm

joy wrote:But it's not working.

The advantage to using a RK miniloader is reduced maintenance burden since there is less uboot code to worry about. However, if it doesn't work then uboot has the advantage since its code is public and can be modified.

joy wrote:For kernel size, we expect actual kernel image size will be reduced

I agree. We only need display driver, PCIe+SATA, USB HDD+mouse+keyboard, and basic networking with a single NIC driver. The only job the kernel and minimal rootfs will do is load and kexec another kernel+dts+uInitrd+args(boot.ini). There should also be some kind of user interface to allow configuring the boot settings.

I will join in testing this soon.
crashoverride
 
Posts: 3914
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1

Re: Odroid N1 SPI Boot flash

Unread postby joy » Mon Mar 12, 2018 6:55 pm

crashoverride wrote:We only need display driver, PCIe+SATA, USB HDD+mouse+keyboard, and basic networking with a single NIC driver. The only job the kernel and minimal rootfs will do is load and kexec another kernel+dts+uInitrd+args(boot.ini). There should also be some kind of user interface to allow configuring the boot settings.

I agree with you.

As a very first and basic approach, I've tried a common kexec method based on this scenario
and some user interfaces like selection menu using display and keyboard will be needed.

1. add kexec defconfig of kernel for SPI booting
like CONFIG_KEXEC_CORE / CONFIG_KEXEC
2. boot from SPI flash
3. judge boot storage (using boot mode pins, gpios) and execute each instruction for the target storage from init script
ex) to jump to SATA disk to load kernel, ramdisk and rootfs in SATA disk
Code: Select all
kexec -l /mnt/ssd1/Image --initrd=/mnt/ssd1/uInitrd --append="swiotlb=1 console=ttyFIQ0,115200n8 root=/dev/sda2 rootfstype=ext4 rootwait rw"
kexec -e

Once I have any update, I will share it here.

crashoverride wrote:I will join in testing this soon.

Good~ :D Let's discuss further steps together!
joy
 
Posts: 496
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: ODROID-C1+, XU4, X

Re: Odroid N1 SPI Boot flash

Unread postby umiddelb » Tue Mar 13, 2018 5:24 am

Instead of reinventing the wheel, you might give petitboot a try.
umiddelb
 
Posts: 440
Joined: Thu Jan 29, 2015 6:42 am
languages_spoken: English, German
ODROIDs: ODROID-C1, ODROID-XU4, ODROID-C2

Re: Odroid N1 SPI Boot flash

Unread postby joy » Tue Mar 13, 2018 11:00 am

umiddelb wrote:Instead of reinventing the wheel, you might give petitboot a try.

umiddelb,
Thank you for your opinion again. :)
Based on you and other users' recommendation and the link, I've studied and investigated petitboot, too,
but it's difficult to get a sense of implementation for actual operation on N1
because I don't have much knowledge about petitboot. :(

I will try petitboot again.
https://www.raptorengineering.com/content/kb/1.html

And if you have any reference resources or links that can help, please share with us.
It will be very helpful.
joy
 
Posts: 496
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: ODROID-C1+, XU4, X

Re: Odroid N1 SPI Boot flash

Unread postby umiddelb » Fri Mar 16, 2018 7:04 am

petitboot builds nicely on the N1:
Code: Select all
sudo apt install autoconf automake autopoint libtool pkg-config libudev-dev libdevmapper-dev
git clone git://git.ozlabs.org/petitboot
cd petitboot
./bootstrap
./configure --with-twin-x11=no --with-twin-fbdev=no
make -j 6
sudo make install
umiddelb
 
Posts: 440
Joined: Thu Jan 29, 2015 6:42 am
languages_spoken: English, German
ODROIDs: ODROID-C1, ODROID-XU4, ODROID-C2

Re: Odroid N1 SPI Boot flash

Unread postby umiddelb » Fri Mar 16, 2018 7:10 am

After starting pb-discover (as root), petitboot-nc (as root) shows up the following System Information. I have to deep dive as well ;)
Attachments
Screen Shot 2018-03-15 at 23.06.15.png
Screen Shot 2018-03-15 at 23.06.15.png (105.7 KiB) Viewed 2452 times
umiddelb
 
Posts: 440
Joined: Thu Jan 29, 2015 6:42 am
languages_spoken: English, German
ODROIDs: ODROID-C1, ODROID-XU4, ODROID-C2

Re: Odroid N1 SPI Boot flash

Unread postby memeka » Fri Mar 16, 2018 9:21 am

nice emmc uuid :P
User avatar
memeka
 
Posts: 4024
Joined: Mon May 20, 2013 10:22 am
languages_spoken: english
ODROIDs: XU rev2 + eMMC + UART
U3 + eMMC + IO Shield + UART

Re: Odroid N1 SPI Boot flash

Unread postby mad_ady » Fri Mar 16, 2018 2:36 pm

I'm sure his sdcard is cafebabe... but wasn't plugged in at the moment :)
User avatar
mad_ady
 
Posts: 4427
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1

Re: Odroid N1 SPI Boot flash

Unread postby joy » Tue Mar 20, 2018 2:27 pm

umiddelb wrote:After starting pb-discover (as root), petitboot-nc (as root) shows up the following System Information. I have to deep dive as well ;)

Awesome!!
Thank you for sharing it. :)
I didn't know the commands like pb-discover and petitboot-nc after installation of packages.
I'm following the instructions.
joy
 
Posts: 496
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: ODROID-C1+, XU4, X

Re: Odroid N1 SPI Boot flash

Unread postby mad_ady » Wed Mar 21, 2018 5:46 pm

I'd like to join the party as well. I got the SPI flash chips - the same that @joy is using (they're small!). I don't have his soldering skills, so I used the clips that came with the Oscilloscope board to clip to the flash pins. I made the same connections that joy did (no VCC, nor ground), but the flash isn't recognized on boot:
Code: Select all
root@n1-pre:~# dmesg | grep spi
[    2.033834] rockchip-spi ff1d0000.spi: Failed to request TX DMA channel
[    2.040462] rockchip-spi ff1d0000.spi: Failed to request RX DMA channel
[    2.047129] of_get_named_gpiod_flags: parsed 'cs-gpios' property of node '/spi@ff1d0000[0]' - status (0)
[    2.047164] of_get_named_gpiod_flags: parsed 'cs-gpios' property of node '/spi@ff1d0000[1]' - status (0)
root@n1-pre:~# dmesg | grep mtd
root@n1-pre:~#

Do I need to connect power and gnd as well, right? And power should be 3V, right?

Thanks
User avatar
mad_ady
 
Posts: 4427
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1

Re: Odroid N1 SPI Boot flash

Unread postby mad_ady » Wed Mar 21, 2018 8:26 pm

I've connected VCC and GND to 3.0V and GND, rebooted, but still the chip is not visible:
Code: Select all
root@n1-pre:~# dmesg | grep spi
[    2.034104] rockchip-spi ff1d0000.spi: Failed to request TX DMA channel
[    2.040732] rockchip-spi ff1d0000.spi: Failed to request RX DMA channel
[    2.047399] of_get_named_gpiod_flags: parsed 'cs-gpios' property of node '/spi@ff1d0000[0]' - status (0)
[    2.047434] of_get_named_gpiod_flags: parsed 'cs-gpios' property of node '/spi@ff1d0000[1]' - status (0)
root@n1-pre:~# dmesg | grep mtd
root@n1-pre:~# uname -a
Linux n1-pre 4.4.114-21 #1 SMP Mon Mar 19 01:05:12 UTC 2018 aarch64 GNU/Linux


The connections look ugly, but should work (electrically):
http://imgur.com/a/GOxDL
User avatar
mad_ady
 
Posts: 4427
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1

Re: Odroid N1 SPI Boot flash

Unread postby phaseshifter » Wed Mar 21, 2018 9:57 pm

odroid N-1 16Gb emmc orange..
phaseshifter
 
Posts: 2904
Joined: Fri May 08, 2015 9:12 am
languages_spoken: english
ODROIDs: N-1..c1+ ..c-2..xu3 lite,xu4...u-3..
u-2...other odroid acc`s as well

Re: Odroid N1 SPI Boot flash

Unread postby crashoverride » Thu Mar 22, 2018 12:33 pm

mad_ady wrote: but still the chip is not visible:

Nothing will show up on the default kernel. You have to enable some kernel drivers for MTD devices and add information to the device tree describing the connection.

This should not impact uboot usage. Using the modified uboot posted earlier should allow you to manipulate the SPI flash.
crashoverride
 
Posts: 3914
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1

Re: Odroid N1 SPI Boot flash

Unread postby joy » Thu Mar 22, 2018 3:10 pm

For kernel driver, you need to add spi-related defconfig and dts parameter.
Please find the attachment.

And first we need to make sure new boot loader and petitboot logic work with another bootable storages. :)

[updated]
I've updated the patch file from the latest kernel.
Attachments
0003_n1_spi_mtd_config_dts.diff.zip
(1.69 KiB) Downloaded 21 times
Last edited by joy on Fri Mar 23, 2018 2:57 pm, edited 1 time in total.
joy
 
Posts: 496
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: ODROID-C1+, XU4, X

Re: Odroid N1 SPI Boot flash

Unread postby joy » Thu Mar 22, 2018 4:48 pm

mad_ady wrote:I've connected VCC and GND to 3.0V and GND, rebooted, but still the chip is not visible:
Code: Select all
root@n1-pre:~# dmesg | grep spi
[    2.034104] rockchip-spi ff1d0000.spi: Failed to request TX DMA channel
[    2.040732] rockchip-spi ff1d0000.spi: Failed to request RX DMA channel
[    2.047399] of_get_named_gpiod_flags: parsed 'cs-gpios' property of node '/spi@ff1d0000[0]' - status (0)
[    2.047434] of_get_named_gpiod_flags: parsed 'cs-gpios' property of node '/spi@ff1d0000[1]' - status (0)
root@n1-pre:~# dmesg | grep mtd
root@n1-pre:~# uname -a
Linux n1-pre 4.4.114-21 #1 SMP Mon Mar 19 01:05:12 UTC 2018 aarch64 GNU/Linux


The connections look ugly, but should work (electrically):
http://imgur.com/a/GOxDL

Hi, mad_ady.
Please refer to this reference schematic.
N1_spi_flash_hw_reference.png
N1_spi_flash_hw_reference.png (35.98 KiB) Viewed 2233 times

You need to set up the PIN#3 (/WP, IO2) and PIN#7 (/HOLD, IO3) including VCC and GND.
And also find HW configuration guide in this link.
viewtopic.php?f=155&t=29976#p214764

I should have shared this detailed guide more earlier, sorry.
We made a sample as this guide depicts and connect all of pins with capacitor and registers equal to specified values.

[ updated ]
I think you already know how to check SPI flash connection.
But just to share the information.... :)
tomorrow I will share some instructions to judge if your spi flash is connected and N1 detects the ID normally.
Without kernel booting, it's available to check it using sf probe from sd booting.
Last edited by joy on Fri Mar 23, 2018 11:05 am, edited 1 time in total.
joy
 
Posts: 496
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: ODROID-C1+, XU4, X

Re: Odroid N1 SPI Boot flash

Unread postby joy » Thu Mar 22, 2018 6:56 pm

umiddelb wrote:After starting pb-discover (as root), petitboot-nc (as root) shows up the following System Information. I have to deep dive as well ;)

Hello umiddelb,
I've installed the packages you mentions including some more
Code: Select all
sudo apt install autoconf automake autopoint libtool pkg-config libudev-dev libdevmapper-dev flex bison petitboot

and done 'make install' of petitboot source codes.
But after pb-discover and petitboot-nc, I got just an empty Petitboot menu only has Exit to Shell.
Also I can't see the Petitboot System Information you shared with us, even though I plugged another card via USB port.

Should I need to follow all of instructions shows in this page, then I can get full petitboot menu?
- systemd, kexec, busybox
https://www.raptorengineering.com/content/kb/1.html
( I will keep following the instructions. )

I think there are a lot of thing I have to set-up more, right? :)
joy
 
Posts: 496
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: ODROID-C1+, XU4, X

Re: Odroid N1 SPI Boot flash

Unread postby mad_ady » Thu Mar 22, 2018 8:22 pm

Thank you @joy and @crashoverride for the details. I'll need to set up a more robust hardware connection to the chip because using test clips is too flakey... I'll get back to you.
User avatar
mad_ady
 
Posts: 4427
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1

Re: Odroid N1 SPI Boot flash

Unread postby joy » Fri Mar 23, 2018 3:10 pm

To confirm spi flash connection of HW, I use these instructions.

1. on U-Boot from eMMC card
- boot from eMMC and check spi flash ID on u-boot stage using "sf probe"
(1) OK
Code: Select all
# sf probe
SF: Detected w25q128bv with page size 256 Bytes, erase size 4 KiB, total 16 MiB

(2) NG
Code: Select all
# sf probe
SF: unrecognized JEDEC id bytes: ff, ff, ff
Failed to initialize SPI flash at 0:0 (error -2)


2. on Kernel
@crashoverride has already shared the info.
viewtopic.php?f=155&t=29976#p216744
additional information...
(1) OK
Code: Select all
root@odroid:~# ls /dev/mtd*
/dev/mtd0  /dev/mtd0ro  /dev/mtdblock0

root@odroid:~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 01000000 00001000 "spi32766.0"

(2) NG
Code: Select all
root@odroid:~# ls /dev/mtd*
ls: cannot access '/dev/mtd*': No such file or directory

root@odroid:~# cat /proc/mtd
dev:    size   erasesize  name

root@odroid:~# dmesg | grep spi
[    2.043953] m25p80 spi32766.0: unrecognized JEDEC id bytes: ff, ff, ff
joy
 
Posts: 496
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: ODROID-C1+, XU4, X

Re: Odroid N1 SPI Boot flash

Unread postby mad_ady » Fri Mar 23, 2018 3:53 pm

Thanks for the help - In my case it seems the connections are not enough/stable and I need to solder them probably to the chip.
Code: Select all
# sf probe
Invalid bus 0 (err=-19)
Failed to initialize SPI flash at 0:0 (error -19)
User avatar
mad_ady
 
Posts: 4427
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1

Re: Odroid N1 SPI Boot flash

Unread postby joy » Fri Mar 23, 2018 4:24 pm

mad_ady wrote:In my case it seems the connections are not enough/stable and I need to solder them probably to the chip.

I think so, too. Try the reference. ;)
joy
 
Posts: 496
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: ODROID-C1+, XU4, X

Re: Odroid N1 SPI Boot flash

Unread postby hominoid » Thu Mar 29, 2018 5:04 am

elatllat wrote:https://www.adafruit.com/product/1239
SMT Test Socket?


FYI, I removed my other post because the test sockets were not the correct size. Neither is this one, it's 10mm. The package is 8-SOIC (0.209", 5.30mm Width)
hominoid
 
Posts: 186
Joined: Tue Feb 28, 2017 3:55 am
Location: Lake Superior Basin, USA
languages_spoken: english
ODROIDs: C2, XU4, MC1, N1

Re: Odroid N1 SPI Boot flash

Unread postby joy » Thu Mar 29, 2018 4:09 pm

Finally, I've confirmed booting switch with petitboot on N1.
Still there are some more works to optimize kernel (remove useless features) and ramdisk (to run petitboot automatically)
but I'm happy now cause I can draw a brief but entire picture.

To keep histories, I share instructions here.

1. Kernel feature - kexec
Code: Select all
diff --git a/arch/arm64/configs/odroidn1_defconfig b/arch/arm64/configs/odroidn1_defconfig
index 89867cf..50a2f06 100644
--- a/arch/arm64/configs/odroidn1_defconfig
+++ b/arch/arm64/configs/odroidn1_defconfig
@@ -200,6 +200,7 @@ CONFIG_SLUB_CPU_PARTIAL=y
 # CONFIG_SYSTEM_DATA_VERIFICATION is not set
 CONFIG_PROFILING=y
 CONFIG_TRACEPOINTS=y
+CONFIG_KEXEC_CORE=y
 # CONFIG_KPROBES is not set
 # CONFIG_JUMP_LABEL is not set
 # CONFIG_UPROBES is not set
@@ -448,7 +449,7 @@ CONFIG_GENERIC_EARLY_IOREMAP=y
 # CONFIG_IDLE_PAGE_TRACKING is not set
 CONFIG_FRAME_VECTOR=y
 CONFIG_SECCOMP=y
-# CONFIG_KEXEC is not set
+CONFIG_KEXEC=y
 # CONFIG_CRASH_DUMP is not set
 # CONFIG_XEN is not set
 CONFIG_FORCE_MAX_ZONEORDER=11

2. install mandatory packages
Code: Select all
$ sudo apt-get install git
$ git clone git://git.ozlabs.org/petitboot

$ sudo apt-get install autoconf automake autopoint libtool flex bison pkg-config libudev-dev libdevmapper-dev petitboot

$ cd petitboot

$ ./boostrap
$ ./configure --with-twin-x11=no --with-twin-fbdev=no

$ make
$ make install


3. conf file
Code: Select all
$ sudo vi /etc/kboot.conf

USB='sda1:/Image initrd=sda1:/uInitrd swiotlb=1 console=ttyFIQ0,115200n8 root=/dev/sda2 rootwait rw'
SATA='sdb1:/Image initrd=sdb2:/uInitrd swiotlb=1 console=ttyFIQ0,115200n8 root=/dev/sdb2 rootwait rw'

After adding kboot.conf, make sure to do system reboot.

4. Run petitboot
Code: Select all
$ pb-discover &
$ mount
.....
/dev/sda1 on /var/petitboot/mnt/dev/sda1 type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=936,iocharset=utf8,shortname=mixed,errors=remount-ro)
/dev/sda2 on /var/petitboot/mnt/dev/sda2 type ext4 (ro,relatime,stripe=10881,data=ordered)

$ petitboot-nc

Code: Select all
Petitboot (13.05.29.14.00-g4dc604b)
  USB
 *Exit to Shell

 ESC=exit, Enter=accept, e=edit, o=open
 Welcome to Petitboot

Code: Select all
Petitboot Option Editor
 image:  /var/petitboot/mnt/dev/sda1/Image                                                   
 initrd: /var/petitboot/mnt/dev/sda1/uInitrd
 args:   root=/dev/sda2 swiotlb=1 console=ttyFIQ0,115200n8 rootwait rw


When I selected and enter USB, then kernel goes to off and after a while I can get kernel and rootfs from USB storage.
Last edited by joy on Tue Jul 31, 2018 2:59 pm, edited 2 times in total.
joy
 
Posts: 496
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: ODROID-C1+, XU4, X

Re: Odroid N1 SPI Boot flash

Unread postby mad_ady » Thu Mar 29, 2018 4:21 pm

It will be nice to extend this to do multiboot between linux and android eventually. Does petitboot have the ability to chainload a different bootloader, or is it unnecessary because android uses the linux kernel anyway?
User avatar
mad_ady
 
Posts: 4427
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1

Re: Odroid N1 SPI Boot flash

Unread postby joy » Thu Mar 29, 2018 6:21 pm

mad_ady wrote:It will be nice to extend this to do multiboot between linux and android eventually. Does petitboot have the ability to chainload a different bootloader, or is it unnecessary because android uses the linux kernel anyway?

Thank you for the good suggestion. I agree with you.

As I know so far, it's not available to load a difference bootloader with petitboot.

I think there may be no problem from boot loader because currently same uboot is used regardless of OS
and bootarg can be set as an petitboot option.

But your mention is an important check point.
And one more thing that flashes across my mind from your comment is how all HW status goes during kexec switching from kernel.
So I need to carefully check it, too.
joy
 
Posts: 496
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: ODROID-C1+, XU4, X

Re: Odroid N1 SPI Boot flash

Unread postby mad_ady » Thu Mar 29, 2018 7:30 pm

I take it that uboot does something differently for Android than Linux and this initialization needs to be replicated in the bootloader?
User avatar
mad_ady
 
Posts: 4427
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1

Re: Odroid N1 SPI Boot flash

Unread postby mad_ady » Fri Mar 30, 2018 2:31 am

I did my best to solder jumper wires to the chip, and while it looks good, it doesn't get discovered in uboot/dmesg :(
https://imgur.com/a/pzM3Q
I have a second chip and I'm waiting for a clip from china to try it on...
User avatar
mad_ady
 
Posts: 4427
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1

Re: Odroid N1 SPI Boot flash

Unread postby phaseshifter » Sat Mar 31, 2018 12:17 am

i am looking at getting one of these

https://www.waveshare.com/w25qxx-dataflash-board.htm
odroid N-1 16Gb emmc orange..
phaseshifter
 
Posts: 2904
Joined: Fri May 08, 2015 9:12 am
languages_spoken: english
ODROIDs: N-1..c1+ ..c-2..xu3 lite,xu4...u-3..
u-2...other odroid acc`s as well

Re: Odroid N1 SPI Boot flash

Unread postby mad_ady » Sat Mar 31, 2018 12:22 am

it looks nice :)
User avatar
mad_ady
 
Posts: 4427
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1

Re: Odroid N1 SPI Boot flash

Unread postby rooted » Sat Mar 31, 2018 1:49 am

phaseshifter wrote:i am looking at getting one of these

https://www.waveshare.com/w25qxx-dataflash-board.htm
That's more like it, broken out and ready to go :)
User avatar
rooted
 
Posts: 5458
Joined: Fri Dec 19, 2014 9:12 am
Location: Gulf of Mexico, US
languages_spoken: english
ODROIDs: C1, C1+, C2
XU3 Lite, XU4
N1
VU7+
HiFi Shield 2
Smart Power (original)

Re: Odroid N1 SPI Boot flash

Unread postby phaseshifter » Sat Mar 31, 2018 2:45 am

ok so you will need to create an acc with them
there are cheaper shipping methods once you reach the checkout
i got fedex so 25usd extra but i also got 5 spare chips at 11$ aud so i can replace a chip if i stuff it up....it`s on the way



phase...
Last edited by phaseshifter on Mon Apr 02, 2018 4:07 pm, edited 1 time in total.
odroid N-1 16Gb emmc orange..
phaseshifter
 
Posts: 2904
Joined: Fri May 08, 2015 9:12 am
languages_spoken: english
ODROIDs: N-1..c1+ ..c-2..xu3 lite,xu4...u-3..
u-2...other odroid acc`s as well

Re: Odroid N1 SPI Boot flash

Unread postby mad_ady » Sat Mar 31, 2018 3:56 am

I thought the nand was soldered to the board. It's tricky to replace (and I'm terrible with the soldering iron)...
User avatar
mad_ady
 
Posts: 4427
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1

Re: Odroid N1 SPI Boot flash

Unread postby phaseshifter » Sat Mar 31, 2018 8:56 am

yes the chip is soldered ..but i had beforehand brought some chips...until i found the unit in question....
odroid N-1 16Gb emmc orange..
phaseshifter
 
Posts: 2904
Joined: Fri May 08, 2015 9:12 am
languages_spoken: english
ODROIDs: N-1..c1+ ..c-2..xu3 lite,xu4...u-3..
u-2...other odroid acc`s as well

Re: Odroid N1 SPI Boot flash

Unread postby hominoid » Sat Mar 31, 2018 12:31 pm

phaseshifter wrote:i am looking at getting one of these

https://www.waveshare.com/w25qxx-dataflash-board.htm

Nice find and the price isn't bad. I looked high and low and could not find a test socket for this chip. It is a wide version of the SOIC-8 narrow according to wikipedia. I order some SOIC-8 breakout boards to try; it looks like the wide will fit because of the extended pads. They were cheap 20 for $3.75 free shipping. Definitly need a smaller soldering iron tip!
hominoid
 
Posts: 186
Joined: Tue Feb 28, 2017 3:55 am
Location: Lake Superior Basin, USA
languages_spoken: english
ODROIDs: C2, XU4, MC1, N1

Re: Odroid N1 SPI Boot flash

Unread postby mad_ady » Tue Apr 17, 2018 10:54 pm

@joy: A bunch of us are playing with their flash chips and have managed to get stuck on this thread: viewtopic.php?f=155&t=30698&p=221489#p221489. Maybe you can tell us what we did wrong. :)

Regarding using uboot in flash - would it be possible/simpler to "partition" the nand so that you can have mtd0 for idbspl.bin, mtd1 for u-boot, mtd2 for environment, ... etc, so that they are easier to backup/restore/flash from the OS?
https://opensourceforu.com/2012/01/work ... d-devices/
I'm not sure where such partitioning is done - I'm guessing in the kernel/dtb?

Edit: I guess it's stored in the mtd?
Code: Select all
root@n1-pre:~# mtdpart -h
Usage: mtdpart add [OPTION] <MTD_DEVICE> <PART_NAME> <START> <SIZE>
       mtdpart del [OPTION] <MTD_DEVICE> <PART_NUMBER>
Adds a partition to an MTD device, or remove an existing partition from it.

  -h, --help    Display this help and exit
  -V, --version Output version information and exit

START location and SIZE of the partition are in bytes. They should align on
eraseblock size.

User avatar
mad_ady
 
Posts: 4427
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1

Re: Odroid N1 SPI Boot flash

Unread postby umiddelb » Wed Apr 18, 2018 5:54 am

mad_ady wrote:I'm not sure where such partitioning is done - I'm guessing in the kernel/dtb?

The partitioning information should be passed via kernel command line parameter, e.g.
Code: Select all
mtdparts=spi0.0:768k(uboot),256k(uboot-environment),-(reserved)

this is the corresponding kernel message during boot:
Code: Select all
[    3.022906] m25p80 spi0.0: sst25vf016b (2048 Kbytes)
[    3.028148] 3 cmdlinepart partitions found on MTD device spi0.0
[    3.034200] Creating 3 MTD partitions on "spi0.0":
[    3.039332] 0x000000000000-0x0000000c0000 : "uboot"
[    3.050716] 0x0000000c0000-0x000000100000 : "uboot-environment"
[    3.060177] 0x000000100000-0x000000200000 : "reserved"

The naming is for decoration purposes only (you will find these names in /proc/mtd), access to the uboot-environment is handled by /dev/mtd1. The corresponding fw_env.config looks like this:
Code: Select all
/dev/mtd1  0x0  0x40000  0x1000


Cheers
Uli
umiddelb
 
Posts: 440
Joined: Thu Jan 29, 2015 6:42 am
languages_spoken: English, German
ODROIDs: ODROID-C1, ODROID-XU4, ODROID-C2

Re: Odroid N1 SPI Boot flash

Unread postby mad_ady » Wed Apr 18, 2018 3:26 pm

Nice, thanks for the info. I'm guessing uboot won't care about the partitioning and you'll have to remember where your limits are.
User avatar
mad_ady
 
Posts: 4427
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1

Re: Odroid N1 SPI Boot flash

Unread postby mad_ady » Wed Apr 18, 2018 4:55 pm

A little offtopic - but useful for people wanting to try this out. I just received this: https://www.aliexpress.com/item/SOIC8-S ... 0.0.ozzmkM and the clips hold the flash IC perfectly and you can connect it to the N1 with jumper cables - no soldering required. And it's cheap, too :)
User avatar
mad_ady
 
Posts: 4427
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1

Re: Odroid N1 SPI Boot flash

Unread postby umiddelb » Thu Apr 19, 2018 4:52 am

mad_ady wrote:Nice, thanks for the info. I'm guessing uboot won't care about the partitioning and you'll have to remember where your limits are.

That's right, you'll have to take a look inside of the u-boot sources (.../include/configs/*.h). The u-boot environment region is determined by the following C-macros:
CONFIG_ENV_OFFSET | CONFIG_ENV_ADDR
CONFIG_ENV_SIZE
umiddelb
 
Posts: 440
Joined: Thu Jan 29, 2015 6:42 am
languages_spoken: English, German
ODROIDs: ODROID-C1, ODROID-XU4, ODROID-C2

Re: Odroid N1 SPI Boot flash

Unread postby mad_ady » Fri May 11, 2018 3:19 pm

@joy - sorry to bother you, but we've been trying to replicate your setup but keep failing. My last find was that data written to the flash (from either uboot or linux) is not the same when read back (from linux). So I put together a small script which writes the data in 2k chunks with a 5s delay in between chunks. Now the data written is the same when read back, but uboot still fails to boot.
I know you've stopped working on this pending a decision, but could you (when you have time) share a dd image of the nand flash you've used with success? I'd like to compare its structure/test it to understand what we're doing wrong.
Thanks!
User avatar
mad_ady
 
Posts: 4427
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1

Previous

Return to Projects

Who is online

Users browsing this forum: No registered users and 1 guest

cron