README.Rev642 David Rowe Created 24 April 2007 Rev 642 is the 1st IP04 prototype. This file contains assembly notes, errata, and software information to help you get started. See also: http://svn.rowetel.com/software/astfin/branches/astfin-ip04/README.IP04 Status ------ See TESTPLAN for a plan/checklist that is being updated as we progress. Assembly Notes -------------- 1/ Orientation of U3A (M25P20). Pin1 is on the side of the chip with 45 deg bevel. 2/ The jtagprog software didnt autodetect the M25P20 SPI flash chip, as the production rev of the M25P20 I am using doesn't support the RDID instruction. So I modified jtagprog to use the M25P20 parameters as a default if the part doesnt respond to RDID. This is probably not the best solution, as a faulty part or PCB will also result in RDID failing. Perhaps a better solution is a manual specification on the SPI flash type, or use the "Production Technology X' version of the M25P20 which does support the RDID instruction. See below for instructions on programming te M25P20 using jtagprog. 3/ You just need to mount one of R115/R116/R117 (Ethernet, near J7 RJ45). Anyone of these is OK but you need to mount at least one. Errata ------ 1/ C117 and C120 labels transposed. This caused an explosion on the prototype as the voltage ratings are different! The easiest fix is to just load both C117 & C120 as 25V 10uF parts. This has been fixed in the SVN copy of ip04.pcb. 2/ The RTC power VDDRTC (pin 18 of U1) is not connected, should be connected to 3V3. U-boot wont start without power to the RTC. The fix is to use a short piece of wire to join the VDDRTC via (near lower LHS or Q2) to the LH end of R37. The schematic/PCB has been fixed in SVN. 3/ Some people have run into reset problems using the 3V3 part for U10. It has been suggested that a 2V5 threshold part is more suitable. Suggested Future Work & modifications ------------------------------------- While assembling the prototype few improvements became obvious, these are under the "Rev 642 PCB Bugs/Comments" section of the TODO file. Software -------- Eventually u-boot, uClinux, and Asterisk will be part of http://astfin.org. As a first step, I am posting some snapshots of binaries and some tar-balls to: http://www.rowetel.com/ucasterisk/downloads/ip04/ Building u-boot --------------- $ tar xvzf u-boot-1.1.5-ip04.tgz $ cd u-boot-1.1.5-ip04 $ make ip04_config && make Initial Flashing using JTAG --------------------------- I use a version of jtagprog hacked for the M25P20 as described above and an IGLOO cable. It takes about 20 minutes to write, or 45 for a write and verify. I got impatient after a while so I tend to Ctrl-C out once the verify starts. Here are the commands I use to program the SPI flash: jtag> cable parallel 0x378 IGLOO Initializing Excelpoint IGLOO JTAG Cable on parallel port at 0x378 jtag> detect IR length: 5 Chain length: 1 Device Id: 01010010011110100101000011001011 Manufacturer: Analog Devices Part: BF533 Stepping: 5 Filename: /usr/local/share/jtag/analog/bf533/bf533 jtag> initbus bf532_bf1 jtag> spidetectflash 0 All 0xffs returned Making the dangerous assumption that we have a M25P20! SPI FLASH: Manufacturer ID: 20 Memory type: 20 Memory capacity: 12 (262144 bytes) Chip: STMicroelectronics M25P20 jtag> spieraseflash 0 4 erasing: jtag> spiflashmem 0 u-boot.ldr program: addr: 0x00019B84 (done) verify: addr: 0x00013F60 Using u-boot to Test u-boot --------------------------- ip04>tftp 0x1000000 u-boot.ldr ip04>go 0x1000000 NOTE: I had to remove a lot of options from u-boot to get the NAND code to fit in the 128k allocated by boards/ip04/config.mk. Lowering TEXT_BASE didn't help - u-boot wouldn't run. Not sure why, if any one knows how to allocate more room for u-boot please tell me! You can see if you have exceed the 128k limit by: $ grep PROV u-boot.map Look at this line of the grep output and make sure it doesn't exceed 0x03ffffff (64M system): 0x03ffe6b8 PROVIDE (end, .) Note that the linker will quite happily place code and data outside of this limit - you need to check manually. Using u-boot to Upgrade u-boot ------------------------------ NOTE: Make sure it's the u-boot.ldr file you tftp and write, not u-boot.bin which is used when testing u-boot using 'go'! ip04>tftp 0x1000000 u-boot.ldr ip04>eeprom write 0x1000000 0x0 $(filesize) ip04>reset Testing uClinux uImage ---------------------- I have some u-boot environment variables set up like this: bootargs=root=/dev/mtdblock0 rw addnet=setenv bootargs $(bootargs) ethaddr=$(ethaddr) ramboot=tftp 0x1000000 uImage.ip04;run addnet;bootm 0x1000000 uImage.ip04 is placed on your tftpserver. Then to download and start uClinux: ip04>run ramboot Notes: 1/ The ethaddr (the MAC address) is passed via the kernel command line, in this case the same MAC as u-boot is used. 2/ To set up environment variables like those above use quotes to make sure the spaces are processed correctly, e.g.: ip04>setenv bootargs 'root=/dev/mtdblock0 rw' Writing a uImage to NAND ------------------------ ip04>tftp 0x1000000 uImage.ip04 ip04>nand erase clean ip04>nand write 0x1000000 0x0 0x4c0000 Notes: 1/ During the tftp step bytes transferred = 4b6901 hex. 'nand write' needs to have the size of the write rounded up to the nearest sector size. 'nand info' gave me a sector size of 128 KiB (0x20000 hex) so I rounded up to 0x4c0000. 2/ This particular uImage is a little too big - it will exceed the mtd kernel partition which is set at only 0x400000, killing the mtd uClinux flash setup. We will be writing smaller files to the kernel partition in practice (i.e. without rootfs and Asterisk). Reference: http://docs.blackfin.uclinux.org/doku.php?id=using_nand_flash_with_u-boot_and_linux_kernel&s=boot%20nand How To set up NAND/yaffs for root --------------------------------- This is a little indirect as the user-mode yaffs tools like mkyaffs are broken. These steps were adpated from Frank Hoffman's instructions here: https://blackfin.uclinux.org/gf/project/uclinux-dist/forum/?action=ForumBrowse&forum_id=39&_forum_action=ForumMessageBrowse&thread_id=8386 1. wget http://www.rowetel.com/ucasterisk/downloads/ip04/uImage.yaffs wget http://www.rowetel.com/ucasterisk/downloads/ip04/copy_root.txt 2. First tftp the ext2 uImage and load into the kernel section of NAND. We neext the ext2 image for the next step (copying files onto yaffs). In u-boot: ip04>tftp 0x1000000 uImage.ext2 ip04>nand erase ip04>nand write 0x1000000 0x0 0x48000 (see Note (1) in "Writing a uImage to NAND" section above re 0x48000) ip04>bootm 0x1000000 3. Now we have the IP04 booted, but using a ram-based ext2 file system for root. So we need to copy /root into the yaffs file system: On the IP04: root:~> copy_rootfs.sh root:~> reboot 4. Now set up u-boot to mount root from yaffs: ip04>setenv autostart yes ip04>setenv bootargs root=/dev/mtdblock2 rw ip04>setenv nandboot 'run addnet;nboot 0x2000000 0x0' ip04>setenv bootcmd run nandboot ip04>save ip04>reset Notes: 1/ Don't used mkyaffs, it is very broken for flash chips with 2048 byte pages, like the one used by the IP04! It will fail badly. To recover use nand erase in u-boot. 2/ In u-boot 'nand dump' is helpful, for example after a nand erase: ip04>nand dump 0x0 (you should see a flash "page" of 2048 0xff's + 64 OOB 0xffs) After 'nand write' use nand dump to see the uImage in NAND. 3/ For reference a typical boot sequence is here: http://www.rowetel.com/ucasterisk/downloads/ip04/ip04_boot_typical.txt 4/ In his post Frank suggests premature retirement of blocks after a few write cycles. I havent seen that yet but suspect we will have some more work to do to sort that out. This: root:~> cat /proc/yaffs Gives stats on the yaffs file system such as retired blocks.