DHT-Walnut-Flameman

Note
please note this page is in updating, it has been merging from the old version of wiky, so keep patient, i will rewrite this documentation in pretty as soon as possible

in case you need a pdf copy of the old doc, or if you need attachments feel free to ask me for them ( speeder@alice.it )

--Flameman 00:15, 1 June 2007 (EEST)

People you could contact if you need help

 * people on irc freenode #edev #mklinux may be asked about
 * flameman, i'm currently use this board for an university project running gentoo-ppc, email speeder@alice.it
 * you ... if you want ;-)

i need to ask these people if they could be reported to be contacted


 * dale-elinux@farnsworth.org
 * GPSfan (irc freenode)
 * Prpplague (irc freenode), Email: danders AT SPAMFREE amltd DOT com

Introduction
The goal of this page is ...

About the board
DHT-Walnut is a shortened name for the Digital Home Technologies PCB 01070201 Rev. 1.1. The DHT-Walnut board is based on the AMCC-Walnut (still available, and still expensive :P). It is a more improved board described at www.amcc.com. A "walnut" searching will inform about schematic and software. Also keep attention @ DENX: they  have developed a lot for the AMCC-Walnut board, and you could find a linux patch for your problem, prettier documentation, developer suit, and much more: in case, you are suggested to have a look to their web pages.

Overview
The board consists of:


 * CPU PowerPC 405GP running at 266mhz
 * RAM PC133 SDRAM slot, currently, only supports single sidded DIMMs
 * LAN On-chip 405GP ethernet, board doesn't have an ethernet MAC address (the monitor/bootloader is able to fix it)
 * UART DCE serial port, speeds up to 230k, only tested to 115200bps
 * PCI two pci slots, keyed for 5V only cards
 * IDE Promise Technologies PDC20265 IDE
 * ROM 512k of boot flash, AMD 29LV040B (amd29lv040b.pdf), soldered on the PCB, if you like to use a socket you have to consider the bootloader will check for the flash manufactor ID, so or you replace the 29LV040B with an other socked-29LV040B, or you have to modify the bootloader
 * POWER the board need to be 12v dc powered 2A max, it is able to feed the hard disk
 * System PCB 6.00" x 7.5" board size
 * RTC the real time clock chip is missing
 * RAM 32M PC133 SDRAM DIMM, the board has issues with more than 128M: if you inspect the pcb, you will see that the DIMM connector has same pin missing, this is the reason why you can't use DIMM bigger than 128M
 * PCI IEEE-1394 card supported by OHCI driver
 * PCI additional ethernet board needed cause the on board ethernet is implemented by the IBM-ppc-405GP, for example netbsd is not able to drive it, so in case you need an additional board, the one provided with DHT is good enough
 * FIRMWARE PPCBoot v.1.1.2 in flash (it has issues with environment, it need to be replaced with a gooder one)

an image of the board
an image of the board:



JTAG & OCD Commander
The OCD Commander is macraigor's free debugger software, which allows you to connect to your supported target type chip via the On-Chip Debug port (BDM or JTAG) using a Macraigor hardware device. You will be able to test the connection, memory access, modify memory and registers, run code and more using this product. This debugger is not designed to be used to program flash devices connected to your target. The OCD Commander software is supported under Windows 98/ME, NT, 2000, 2003, XP operating systems

supported devices


 * mpDemon
 * Raven
 * Wiggle
 * usb2demon
 * usb2sprite
 * usbwiggler

See How To build the JTAG Wiggle interface & add the JTAG connector at J10 Just in case you make a brick, you could fix the jam, using this procedure: JTAG Bootloader Installation

JTAG add the J10 to the board
suck or wick the solder out of the holes and solder it in, but be minded a common header has pins larger than holes, so ... be careful about what you do: you could damage the PCB



the jtag pinout


 * pin DHT-WALNUT AMCC-PPC4xx
 * 01      TDO       TDO
 * 02      nc        nc
 * 03      TDI       TDI
 * 04      TRST      TRST
 * 05      *NC*      *NC*
 * 06      Vcc       Vcc
 * 07      TCK       TCK
 * 08      nc        KSTP_IN
 * 09      TMS       TMS
 * 10      nc        nc
 * 11      SRESET    SRESET
 * 12      nc        nc
 * 13      HRESET    HRESET
 * 14      nc        reserved
 * 15      nc        CKSTP_OUT
 * 16      gnd       gnd

NOTE


 * DHT-Walnut: JTAG Pin Out Connector Specifications for DHT-walnut-PPC405GP
 * AMCC-PPC4xx: JTAG Pin Out Connector Specifications for AMCC PPC 44X, 40X (4XX) Processors: 405EP, 405GP, 405GPR, 440GP, 440EP, 440GX, 440GR, 440EPX, 440GRX, 440SP, 440SPE

Pin Out description


 * TDO=JTAG Test Data Out
 * TDI=JTAG Test Data In
 * TRST=JTAG Test Reset
 * TCK=JTAG Test Clock
 * TMS=JTAG Test Mode Select
 * *NC*=not connected, used as cable reference
 * nc=simply not connected
 * SRESET=Soft-Reset
 * HRESET=Hard-Reset
 * KSTP_OUT=?
 * CKSTP_IN=?
 * Vcc=board ref voltage, 3V

About the jtag cable

the the "Wiggler Buffered JTAG Programmer" is compatible with the old OCD. This schematic has been tested and it is working.



NOTE

(1) from http://www.macraigor.com/cpus.htm and you can download the OCD-commander, but it will not work with the wiggle 'cause in the new OCD-commander

- AMCC PowerPC PPC405 wiggler is NOT supported

- IBM PowerPC PPC 405 wiggler is NOT supported

you need to download this old version, that i tested with success

[[Media:OCD-Commander-for-wiggle.zip|OCD-Commander-for-wiggle.zip]]

(it works under windows 98,NT,2000,xp)

(2) in case your lab is equipped with the bdi2000, you are warned this hw is known to be working with the dht-walnut jtag. In case you are not equipped with, you are warned this hardware is expensive a lot, 'cause it is not a simple download cable, it a professional debugger)

JTAG build the Wiggle Cable
under updating ...

OCD, Experimental hack
Experimental hack to set a hardware breakpoint inside OCD Commander [media:hardbreak.tgz]


 * OCD Commander macro file to dump the CPU configuration (all but PCI) [media:dump_config.mac]
 * OCD Commander macro file to configure the system for recovery attachment:recovery_config.mac]
 * CPU configuration of the system after a warm reset [media:warm_reset.config]
 * CPU configuration of the system once ppcboot v1.1.2 is up and running [media:ppcboot.config]
 * CPU configuration of the system once ppcboot v1.1.6 is up and running [media:ppcboot_116.config]
 * Example OCD logfile of the using the recovery macro to load ppcboot [media:ocd_recovery_log.txt]
 * Example console log from ppcboot v.1.1.6 running from ram after recovery macro [media:ocd_recovery_console_log.txt]

OCD, Recovering a bricked board
Using OCD Commander, a JTAG adapter, and GPSFan's ram resident ppcboot, it is possible to reprogram the flash. In short, use OCD Commander to turn on the sdram, download the ram targeted ppcboot, and install a new bootloader.

You'll need a macro file [[Media:recovery_config.mac|recovery_config.mac]] and the ppcboot image [[Media:ppcboot_ram.s19|ppcboot_ram.srec]].

There's also an experimental ram-resident version of u-boot-1.1.4 attachment:u-boot-ram.s19 that can be downloaded to 0x400000. Source diffs against the current version from CVS, incorporating the patches from both GPSFan and dfarnsworth: attachment:u-boot-ram.patch. Expect to see much more output at boot, as this version has debug output turned on. (Other changes include setting the entry point in the linker script, output files renamed to u-boot.s19 and u-boot.elf, sdram config disabled, added debug info on code relocation, and a modified default environment.)

* PC: FFFFFFFC   CR: 00000000  MSR: 00000000  LR: 01FD327C * B -524028 * ppcboot_ram.s19: downloaded 163100 bytes in 0 minutes, 22.785 seconds * PC set to starting address 0x00400000
 * Start OCD Commander, connect to the board, reset, and halt.
 * reset
 * The CPU should be ready to fetch the first instruction:
 * cpu
 * Configure the system:
 * recovery_config (Or hit the macro button and navigate to the recovery_config.mac file.)
 * endian big (BIG Endian set for WORD and DASM commands)
 * Download the ppcboot image to ram:
 * down
 * Jump to the startup (which isn't the same as the download address):
 * go 0x400100

At this point, you should have a running ppcboot v1.1.6. Install a new flash resident bootloader using the bootloader update procedure Installing the Updated Bootloader

Bootloaders

 * ppcboot
 * Here is the latest ppcboot 1.1.6 patch, as is, it will build for flashing at 0xfff80000 as a replacement for the pcboot-1.1.2 that comes with the board.
 * [[Media:patch-ppcboot-1.1.6-km2|patch-ppcboot-1.1.6-km2]] Original sources for ppcboot: ftp://ftp.denx.de/pub/ppcboot/ppcboot-1.1.6.tar.bz2
 * Here is a binary for those without a toolchain. [[Media:ppcboot1.1.6.1.bin|ppcboot1.1.6.1.bin]] crc = 083fb0a3
 * S-Record [[Media:ken_ppcboot.srec|ken_ppcboot.srec]]
 * use this (at your own risk) see the detailed update procedure description: Installing the Updated Bootloader
 * U-Boot
 * It is a significantly updated replacement for ppcboot.
 * U-Boot for the DHT-Walnut
 * DENX U-Boot and Linux Guide for Walnut

Bootloaders: U-Boot 1.1.4

 * Information on U-Boot can be found at
 * The source for U-Boot 1.1.4 is downloadable from ftp://ftp.denx.de/pub/u-boot/u-boot-1.1.4.tar.bz2
 * Here is a patch that makes it work on the DHT-Walnut: u-boot-dht-walnut-df2.patch.
 * A binary that can be copied to the DHT-Walnut flash at 0xfffc0000 is available here: u-boot-1.1.4-df2.bin

Changes since u-boot-1.1.4-df1.bin:
 * A default ethaddr is now set: de:ad:be:ef:00:00
 * The ethaddr can be changed as often as you like. Use: setenv ethaddr be:ef:be:ef:be:ef ; saveenv
 * Only the first two memory banks of a DIMM are used. This allows us to use (half of) double-sided DIMMS.

Some things to note when changing from ppcboot to U-Boot:
 * Default baudrate is 115200.
 * Occupies flash addresses 0xfffc0000-0xffffffff (256MB).
 * Maintains two copies of environment data, primary copy at 0xfffb0000, backup copy at 0xfffa0000.

Bootloaders: U-Boot 1.1.4, Installing

 * Boot the board and bring it to the ppcboot (or U-Boot) console prompt.
 * Download the new bootloader [[Media:u-boot-1.1.4-df2.bin]u-boot-1.1.4-df2.bin]] into RAM:

(1) Using Kermit (you'll need a terminal emulator that supports the kermit file transfer mode): loadb 800000 115200''
 * Switch baudrate to 115200 bps and press ENTER ...
 * Ready for binary (kermit) download ...
 * Start Addr=0x00800000
 * Switch baudrate to 9600 bps and press ESC ...

(2) Using tftpboot (requires a tftp server and setting the environment variables ethaddr, ipaddr and serverip) * TFTP from server 192.168.1.1; our IP address is 192.168.0.44 * Filename 'u-boot.bin'. * Load address: 0x800000 * Loading: done * Bytes transferred = 262144 (40000 hex)
 * tftpboot 800000 u-boot-1.1.4-df2.bin Using ppc_4xx_eth0 device
 * Verify that the download was received correctly (crc should be 0xd3cef189):
 * crc 800000 40000
 * CRC32 for 00800000 ... 0083ffff ==> d3cef189
 * Unprotect the last 4 sectors:
 * protect off fffc0000 ffffffff
 * Un-Protected 4 sectors

'''From this point on, do *not* power down the board, and type *very* carefully. This is the critical section.'''

* Erase Flash from 0xfffc0000 to 0xffffffff * Erasing sector fffc0000 * Erasing sector fffd0000 * Erasing sector fffe0000 * Erasing sector ffff0000 * done * Erased 4 sectors * Copy to Flash... done * CRC32 for fffc0000 ... ffffffff ==> d3cef189
 * Erase the last four sectors:
 * erase fffc0000 ffffffff
 * Copy the new bootloader into flash:
 * cp.b 800000 fffc0000 40000
 * Verify that the image is correct (crc of u-boot-1.1.4-df2.bin is 0xd3cef189).
 * crc fffc0000 40000

'''End of critical section. Congratulations!'''


 * Reset the board and see that the new version booted!
 * Don't forget to change your baud rate to 115200!
 * reset

You will see a message like : *** Warning - bad CRC, using default environment. That's normal. It will go away after you issue a saveenv command.

OS: NetBSD

 * Netbsd has a port for "IBM PowerPC 405GP based Walnut evaluation board", this is not the DHT-Walnut, this is an other way to call the AMCC-Walnut (yes just to be confusing). Ok, it is not for DHT-Walnut, but this port could be (easealy / hardly) adapted to the DHT-Walnut with some work / over work

OS: NetBSD, Hardware that is known to work with

 * see netbsd web, the hw could be (easealy / hardly) adapted to the DHT-Walnut with some work / over work

OS: Linux

 * Version 2.4 (Mostly) working kernel binary and config from jbevren with matrox fbcon and usb input support. Current issues: USB keyboard input doesnt seem to work, but events reach /dev/input/event0
 * Version 2.6 working

OS: Linux, boot from HD
Work In Progress

ppcboot/U-Boot provides only basic functionality to access Hard disks: you can print the partition table and read and write blocks (addressed by absolute block number), but there is no support to create new partitions or to read files from any type of filesystem. The current version of ppcboot-1.1.6 has a problem with writing to hdd, however, once the Linux kernel is loaded and the userland initialized, the hdd can be accesses normally through PIO and DMA modes. This may or may-not be fixed in the future.

As usual, you can get some information about the available IDE commands using the help command in ppcboot:

=> help ide ide reset - reset IDE controller ide info - show available IDE devices ide device [dev] - show or set current device ide part [dev] - print partition table of one or all IDE devices ide read addr blk# cnt ide write addr blk# cnt - read/write `cnt' blocks starting at block `blk#' to/from memory address `addr'

You may create the needed partitions by tftpbooting Linux and an appropriate userland, then use fdisk to partition the disk. Then reboot back to ppcboot.

ppcboot can be configured for DOS and Mac OS? type partition tables. Since ppcboot cannot read files from a filesystem you should create one (or more) small partitions (maybe 1 or 2 MB) if you want to boot from the "disk". (The size of these partitions will depend on how large your kernel and userland images are)

You should create the following partiton table under Linux:

hde: hdx1 hdx2 hdx3 hdx4
 * 1) fdisk /dev/hdx

Device Boot   Start       End    Blocks   Id  System /dev/hde1                                            83   Linux < dd if=kernel of=here /dev/hde2                                            83   Linux /dev/hde3                                            83   Linux /dev/hde4                                            82   Linux swap

Setting up swapspace
 * 1) mkswap /dev/hdx4

You should have two small boot partitions (/dev/hdx1 and /dev/hdx2, 2 MB each), one big partition to hold a filesystem (/dev/hdx3), and a swap partition (/dev/hdx4). You should also initialized /dev/hdx4 as swap space.

ppcboot/U-Boot will recognize this partition table as follows:

=> ide part

Partition Map for IDE device 0 --   Partition Type: DOS

Partition    Start Sector     Num Sectors     Type 1                                                           83    2                                                            83    3                                                            83    4                                                            82


 * dd if=kernel.img of=/dev/hdx1

To boot from a disk you can use the diskboot command:

=> help diskboot diskboot loadAddr dev:part

The diskboot command expects a load address in RAM, and a combination of device and partition numbers, separated by a colon. It then reads the image from disk and stores it in memory. We can now boot it using the bootm command [to automatically boot the image define the ppcboot environment autostart with the value =yes=].

=> diskboot 400000 0:1 ide_read dev 0 start 0, blocks 1 buffer at 3F9F8C0
 * 1) Valid DOS partition found ##

Loading from IDE device 0, partition 1: Name: hda1 Type: PPCBoot First Block: 63, # of blocks: 8001, Block Size: 512 ide_read dev 0 start 3F, blocks 1 buffer at 400000 Image Name:  DHT Kernel Created:     2006-02-05  19:37:25 UTC Image Type:  PowerPC Linux Kernel Image (gzip compressed) Data Size:   1085059 Bytes = 1059 kB = 1 MB   Load Address: 00000000 Entry Point: 00000000 ide_read dev 0 start 40, blocks 847 buffer at 400200

=> bootm 400000 c00000 Image Name:  DHT Walnut Kernel Image Type:  PowerPC Linux Kernel Image (gzip compressed) Data Size:   1085059 Bytes = 1059 kB = 1 MB   Load Address: 00000000 Entry Point: 00000000 Verifying Checksum ... OK  Uncompressing Kernel Image ... OK ...
 * 1) Booting image at 00400000 ...

=> setenv bootargs root=/dev/ram0 => setenv autostart yes => disk 400000 0:1 \;\ diskboot c00000 0:2 \;\ bootm 400000 c00000

=> bootd ide_read dev 0 start 0, blocks 1 buffer at 3F9F518
 * 1) Valid DOS partition found ##

Loading from IDE device 0, partition 1: Name: hda1 Type: PPCBoot First Block: 63, # of blocks: 8001, Block Size: 512 ide_read dev 0 start 3F, blocks 1 buffer at 400000 ..

The above procedure puts the userland image from the second partition into a ramdisk. If you would like the userland to be an ext2/3/rieser/xfs partition on the hdd do the following:


 * put the kernel and small userland onto the first and second partitions as above
 * boot as above from the hdd to the ramdisk userland
 * bring up the network and NFS mount a remote filesystem
 * mkfs.ext2/3/reiser/xfs /def/hde3
 * mount the resulting partition somewhere convienent
 * populate that partition with the appropriate files
 * sync, and unmount all mounted filesystems
 * reboot to ppcboot
 * change bootargs to "bootargs root=/def/hdx3"
 * bootd to try out the new root, if it works ok, reboot back to ppcboot, change the bootargs again and saveenv
 * bootd and enjoy your new system.

This page was modified from and mostly lifted from:

OS: Linux, Hardware that is known to work with
There is a list of the Hardware that is known to work (and not to work) with this board. Feel free to add, comment, feedback about it.


 * matrox millennium I/II
 * 3com-netcard

OS: Linux, from sources
Linux 2.6 has issues in the source's tree: the dht-Walnut has been originally ported to arch=ppc, while the new kernel tree is around arch=powerpcc, for this reason you need to specify the right arch or your compiler will have issues. Developers will port everything to arch=powerppc in the future. Kernel 2.6.12 is free of this problem, newer than .12 have it.

DHT-Walnut as N.A.S.


I turned a DHT-Walnut + 300Gb hard disk into a file server to have my data files connected and shared to the LAN (Local Area Network).

N.A.S. stands for Network Attached Storage. They are storage devices attached to the lan. A NAS should be able to be connected to every kind of network. It should use both the access protocols NFS (Network File System) and CIFS (Common Internet File System)

I only enabled NFS service in the kernel configure because i don't need CIFS. UNIX servers use NFS, while Microsoft systems use CIFS, fortunately i don't have any Microsoft systems here :P Gentoo is installed in the first little partition of the hard disk (it is PC-partition style, so you can only have 4 partitions). It runs openssh, telnet, ftp, tftp, and NFS. As the fact there is no RTC chip installed i added special /etc/init.d/clock-sync to set the local time. The scrips uses rdata to retrieve the current time of an other machine.

In the photo you could see the case i realized: the hard drive is connected to the opened door, the DHT-walnut PCD has been placed inside, the green LED has been used to the frontal case to say "the booting has been completed, the system is ready" (used the gpio hack provided in patches for the 2.6.16-rc3). The black platform is from sony playstation2 and is is only a nice way to have the case vertically seated.

Don't keep about the ALS4000 pci sound board  plugged in the upper PCI bus. It has been plugged just to use the NAS as the giant (300Gb) ipod you have ever seen .... but this is an other story ....

DHT-Walnut as MP3-player
Following in the footsteps of Nate True, I turned a DHT-Walnut + parts into a server to play my music collection. It grabs the data via nfs from an NSLU2, and is controlled via various mpc-like clients from my desktops.

mpd server



After the above was running flawlessly for a day, somehow the usb audio device got fried. May have been a ground loop in the stereo. I had gotten used to having music playing. so I dug out an old PCI sound card (CS4280 based) and compiled the drivers and plugged it in. GIGO... seems like IBM4xx DMA support needs to be turned on in the kernel to make it work. Things are fine now with a few extra ground wires, just to be sure.

Note: to use a PCI-sound card you need to use ppcboot. U-boot-1.1.6 has an issue with kernel initialization. It is under fixing, but today it causes the DMA not to work correctly with the sound card. No sound at all.