Sunday, February 27, 2011

Flash MZK-W04NU back to factory firmware

Here is the steps to flash MZK-W04NU back to factory firmware with TFTP
you will need
(1) TTL Serial cable connect to MZK-W04NU J1 serial port.
(2) TFTPD server with modified factory firmware

Reflash MZK-W04NU back factory firmware
File: mzkw04nu_v10323.bin 0x780000 Bytes

Have to modify original firmware remove first 34(0x22) bytes ( make the first 4 bytes start with 0x27 0x05 0x19 0x56 )

Connect to MZK-W04NU with serial terminal
J1 pinout:
Pin1: 3.3V
Pin2: RX
Pin3: TX
Pin4: GND

In router serial terminal 115200 8N1
after booting, after you see
=========================================
### main_loop: bootcmd="bootm 0xbf050000"
Hit any key to stop autoboot: 0
=========================================
hit any key, you will get into U-boot command line

ar7100>
// setup tftp client to get firmware in ram
setenv serverip 192.168.1.254; setenv ipaddr 192.168.1.1
tftp 0xa0800000 mzkw04nu_v10323.bin
// wait till finish the check the image with iminfo
iminfo 0xa0800000

// Make sure you have good image, no bad magic number
// Then load image to flash
erase 0xbf050000 +0x770000
cp.b 0xa0800000 0xbf050000 0x770000
reset
/// done

================================================
In XP setup a TFTP server
use this one http://tftpd32.jounin.net/
================================================
server use fix IP 192.168.1.254
and put mzkw04nu_v10323.bin ( modified firmware )in the folder
connect to mzk-w04nu ethernet port 1 ( not WAN )


==================================
Here is the log for good flash
==================================
U-Boot 1.1.4 (Oct 25 2007 - 15:28:59)

AP81 (ar7100) U-boot
DRAM:
sri
32 MB
Top of RAM usable for U-Boot at: 82000000
Reserving 222k for U-Boot at: 81fc8000
Reserving 192k for malloc() at: 81f98000
Reserving 44 Bytes for Board Info at: 81f97fd4
Reserving 36 Bytes for Global Data at: 81f97fb0
Reserving 128k for boot params() at: 81f77fb0
Stack Pointer at: 81f77f98
Now running in RAM - U-Boot at: 81fc8000
id read 0x100000ff
flash size 8MB, sector count = 128
Flash: 8 MB
*** Warning - bad CRC, using default environment

In: serial
Out: serial
Err: serial
Net: ag7100_enet_initialize...
Fetching MAC Address from 0x81fedb10
eth0: 00:90:cc:f4:9e:2e
dup 1 speed 100
eth0 up
eth0
====check reset button function====
### main_loop entered: bootdelay=4

### main_loop: bootcmd="bootm 0xbf050000"
Hit any key to stop autoboot: 0
ar7100> setenv serverip 192.168.1.254; setenv ipaddr 192.168.1.1
ar7100>
ar7100> tftp 0xa0800000 mzkw04nu_v103231.bin
Using eth0 device
TFTP from server 192.168.1.254; our IP address is 192.168.1.1
Filename 'mzkw04nu_v103231.bin'.
Load address: 0xa0800000
Loading: checksum bad
checksum bad
len bad 82 <>
checksum bad
T #################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
##########################################
done
Bytes transferred = 7864320 (780000 hex)
ar7100> iminfo

## Checking Image at a0800000 ...
Image Name: Linux Kernel Image
Created: 2009-06-16 6:57:48 UTC
Image Type: MIPS Linux Kernel Image (gzip compressed)
Data Size: 1435411 Bytes = 1.4 MB
Load Address: 80002000
Entry Point: 802c9000
Verifying Checksum ... OK
ar7100> erase 0xbf050000 +0x770000
Erase Flash from 0xbf050000 to 0xbf7bffff in Bank # 1
First 0x5 last 0x7b sector size 0x10000
123
Erased 119 sectors
ar7100> cp.b 0xa0800000 0xbf050000 0x770000
Copy to Flash... write addr: bf050000
done
ar7100> reset

Monday, December 13, 2010

Renesas RDKRX62N Demo Kit arrived!


Got my free Renesas RDKRX62N Demo Kit for Renesas RX Design Contest.
Very Nice tool kits to play with.

Friday, December 10, 2010

Roomba with XV-11 Lidar


Neato XV-11 Laser Distance Scanner test in Ubuntu 10.10 with Xevel's NXV-11 vpython code.


Roomba Create carry the XV-11 LDS and a laptop

Wednesday, December 8, 2010

Arduino mega XV-11 LDS motor dirver test




I make a adapter using Arduino mega 1280 to output PWM to control XV-11 LDS motor.
LDS motor power directly from USB 5V with a IPS041L low side switch control with PWM.
The XV-11 LDS data is connect to Arduino mega RX3 then relay senf out from TX ( USB-serial ).
So the user can use Xevel's program to see the lidar plot. [update] Currently it is has simple close loop control. Arduino mega code you can get from here( github).


Monday, December 6, 2010

NXV11 python code test

Did some test with Xevel's code. Fix some display issues and make plot more easy to read.
Here is the list of improment

  1. Fix view point make lidar scan display correctly.
  2. Add ring every meter make it easy to read distance
  3. Enable the 0 degree heading line.
  4. Moving label,text so we can have clear view of the scan.
Here is the link to github (fork from NXV11).

Sunday, December 5, 2010

Neato XV-11 LDS menu test

This is part of the Open Lidar project to hack into Neato XV-11's LDS (Laser Distance Sensor), Hash is the first one found out the menu. That's try something.

  1. help
    #help
    Help...press ESC 3 times to abort...
    GetVersion
    Help
    Log
    SaveCal
    SetBaud
    SetSerial
    Upload
    Wanderer
    Calibrate b16 b8 SunBlind loop2AA loop155
    GetCal A B C LPT LFL LFT LFH IMX IB LPI LCH LPD ANG
    SetCal A B C LPT LFL LFT LFH IMX IB LPI LCH LPD ANG
    Spin Fake DotX DotI Text Hash Timing Foto RPS Pac
    TestEncoder
    SUCCEEDED
  2. getversion
    #getversion
    GetVersion...press ESC 3 times to abort...OK
    Piccolo Laser Distance Scanner
    Copyright (c) 2009-2010 Neato Robotics, Inc.
    All Rights Reserved

    Loader V2.4.13386
    CPU F2802x/c600
    Serial AAA42110AA-0003662
    LastCal [2010182117]
    Runtime V2.4.13386
    SUCCEEDED
  3. log
    #log
    Log...press ESC 3 times to abort...
    FWL,20633,13264,13386,
    FWR,20633,6,13386,
    FWL,9131,13386,13265,
    FWR,9131,6,13265,
    LSR,9131,120,200,404,299,315,702,502,698,
    FOC,9131,145,284,768,21,21,22084,22952,
    FOC,4331,86,300,32767,0,0,11976,14488,
    LSR,2131,120,192,409,292,299,702,484,697,
    FOC,2131,132,272,780,21,21,18360,20072,
    LSR,21231,120,192,408,294,305,702,492,698,
    FOC,21231,156,296,760,23,23,656,25832,
    FWL,21232,13265,13386,
    FWR,21232,6,13386,
    CTA,21232,666,80,
    CTC,21232,666,80,
    CAL,21232,100,21770,9432,0,
    CTA,21232,148,12063,385,374,111,
    CTC,21232,120,19300,622,591,319,
    CAL,21232,100,22054,8557,0,
    SUCCEEDED

  4. wanderer
    #wanderer
    Wanderer...press ESC 3 times to abort...

    .-"""-. .-"""-.
    /,:;;:; ,'=. \
    : ;:;:;' .=" ,'_\ ;
    : ':;:;,/ ,__:= ;
    \ ';;:; =./)_ /
    `.`"=\_ )_"`.'
    `. ``'".'
    `. .'
    `.'

    SUCCEEDED
  5. getcal
    #getcal
    GetCal...press ESC 3 times to abort... 0005199398 SUCCEEDED
  6. testencoder. This test I use 3.3V to power LDS motor then read the result.
    This is use to test encoder, first column is degrees, then the preiod time , low-time, column 4 last 3 digit is RPM
    To test, stop motor first, then type "testencoder" enter, then power motor. Then you will see the testing result.
    #testencoder
    0000 0000511499 0000110414 00000084950310
    0024 0000512462 0000239437 00000085520310
    0048 0000514797 0000240747 00000083770310
    0072 0000516183 0000241340 00000085840310
    0096 0000516868 0000241576 00000084400310
    0120 0000517073 0000241078 00000084690310
    0144 0000517073 0000241548 00000084830310
    0168 0000515233 0000240405 00000085670310
    0192 0000515167 0000240376 00000083850310
    0216 0000514274 0000240028 00000083850310
    0240 0000514397 0000240514 00000086080310
    0264 0000513840 0000239734 00000086920310
    0288 0000513135 0000239671 00000084090310
    0312 0000512886 0000239463 00000087510310
    0336 0000511497 0000238337 00000086970310
    Deg. Timer1 Timer2 RPM
    Base on the timer1 counter number we can calculate the DSP is running at 40MHz, fits TI's
    TMS320F2802x Piccolo MCU.


  7. spin
    spin text
    spin rps
  8. setbaud
    setbaud 9600

LaserBot assembled

Here is the my little robot with Neato's XV-11 360 degree laser scanner. Runs with 12V battery, control by dsPIC33FJ64MC802 MCU communicate with PC via BGB203 Bluetooth. The circuit board/robot was using for my old robot project but it fits nicely with new Laser Distance Sensor (XV-11 LDS). I plan to use it to finish the SLAM challenge form the Open Lidar Project

Here is the spec.:
MCU: dsPICFJ64MC802
Motor: PITTMAN GM9434H128R2 24V DC ,GEAR RATIO=19.7:1 , @ 24V max speed 313 RPM
ENCODER: MTL MEH-17-300, 300 PPR
WHEEL Diameter: 9.6 cm
H-Bridge: L298 Dual H-Bridge Motor Driver, 2A max each channel.
LDS motor is power by TIP102 NPN Darlington Transistor(Low side drive). Motor only need around 3.3V 65mA to operate.
OS: Running FreeRTOS V6
Communication: BGB203 Bluetooth(Sparkfun) @115200BPS

Board layout
Circuit board with XV-11 Laser Distance Sensor