Wednesday, 20 July 2016

Setting up the XYZ Da Vinci 1.0a 3D printer with RepetierHost and Slic3r on Ubuntu

I finally bought a 3D printer. It's a used one and entry level, but printing parts is good fun. Here's how to set it up on Ubuntu 14.04:

Install Repetier firmware

The new firmware will give you much more control over the printing process. Mine was already installed (v0.92), so I upgrading to the 0.92.10 alpha was as easy as cloning the github repo, starting the Arduino IDE and flashing the printer. This version supposedly has better bed leveling, though I'd recommend to manually level the bed anyway (paper method).
Get the firmware here. You'll also need to have the the Arduino IDE 1.6.7+ for installing and updating it.

Install RepetierHost

  • Download RepetierHost for Linux.
  • Unpack it to the directory you want to install us to, e.g. ~/RepetierHost.
  • Drop to the command line and run "sh configureFirst.sh"
  • If your user can not access the serial port, add it to the dialout group using "usermod -a -G dialout YOURUSERNAME".
More information about the installation is here

Install Slic3r

  • Download Slic3r for Linux.
  • Unpack it to the RepetierHost installation directory under "/plugins/Slic3r".
  • Install the prerequisites using "sudo apt-get install build-essential libgtk2.0-dev libwxgtk2.8-dev libwx-perl libmodule-build-perl".
  • Start RepetierHost and add Slic3r in the "slicer" tab under "Manager". Select "Slic3r" in the drop-down entry and enter "slic3r" and its name. Click "Add Slicer". Enter "/home/YOURUSERNAME/.slic3r" as the configuration directory and the path to the slic3r executable you installed before and press "Apply".
Now you have RepetierHost and and Slic3r and can connect to the printer, so let's set it up:

RepetierHost settings

Printer settings

  • Connection - Port: /dev/ttyACM0 (this may vary on your system)
  • Connection - Baud rate: 230400 (Check you printers settings via the menu)
  • Connection - Transfer protocol: "Repetier Protocol"
  • Connection - Reset on Emergency: "Send emergency command and reconnect"
  • Connection - Receive Cache Size: 202
  • Connection - Use Ping-Pong Communication: Turn on
  • Printer Shape - X Max: 200
  • Printer Shape - Y Max: 200
  • Printer Shape - Print Area Width: 200
  • Printer Shape - Print Area Depth: 200
  • Printer Shape - Print Area Height: 200
  •  Extruder - Extruder 1 Diameter: 0.4

Slic3r settings

Print settings (for all layer heights, add settings if they don't exist)

  • Layers and Perimeters - Perimeters (minimum): 3
  • Layers and Perimeters - Solid layers: Top 3, Bottom 3
  • Layers and Perimeters - Avoid crossing perimeters: Turn on
  • Speed - Perimeters: 50 mm/s
  • Speed - Small perimeters: 10 mm/s
  • Speed - External perimeters: 50%
  • Speed - Infill: 70 mm/s
  • Speed - Solid infill: 50 mm/s
  • Speed - Top solid infill: 30 mm/s
  • Speed - Support material: 30 mm/s
  • Speed - Support material interface: 100%
  • Speed - Bridges: 50 mm/s
  • Speed - Gap fill: 15 mm/s
  • Speed - Travel: 150 mm/s
  • Speed - First layer speed: 30%
  • Advanced - Solid infill: 85% 
  • Advanced - Top solid infill: 85%

Filament settings (add filaments if you don't exist):

  • Filament (ABS) - Temperature - Extruder: 235° / 230°
  • Filament (ABS) - Temperature - Bed: 95° / 90°
  • Cooling (ABS) - Fan speed: 80% / 100%
  • Cooling (ABS) - Slow down if layer time is below: 15s
  • Filament (PLA) - Temperature - Extruder: 200° / 195°
  • Filament (PLA) - Temperature - Bed: 75° / 70°
  • Cooling (PLA) - Fan speed: 40% / 100%
  • Cooling (PLA) - Slow down if layer time is below: 15s

Printer settings

  • General - Set up the bed shape to 200x200mm.
  • G-code flavor must be "RepRap (Marlin/Sprinter/Repetier)".
  • Custom G-code - Start:
M140 S[first_layer_bed_temperature] ; Bed (no wait)
M104 S[first_layer_temperature] ; Extruder (no wait)
M106 S255 ; Start fan
G90 ; set absolute coordinates
G28 ; home all axis
M190 S[first_layer_bed_temperature] ; Bed (wait)
M109 S[first_layer_temperature] ; Extruder (wait)
M117 Start
M300 s1000 p400 ; Beep
M300 s1500 p400
M300 s2000 p400
M300 s2500 p400
M117 Cleaning
M100 ; Cleaning
G1 Z5 F1500
G1 X0 Y15 F1000
G1 X5 Y35 F1000
G92 E0 ; reset extrusion distance
G1 Z[first_layer_height] F4800.000
G1 X5 Y175 E14 F1000
G1 X5 Y190 F1000
M117 Printing
  • Custom G-code - End:
M117 Done
G92 E0 ; reset extrusion distance
M104 S0 ; turn off extruder
M140 S0 ; turn off Bed
G90 ; Absolute
G28 X0 Y0 ; home
M117 Down Bed
G1 Z200 ; Lower bed
M117 Cleaning
M100 ; Cleaning
M84 ; Disable motors
M117 Cooling
M190 S55 ; Bed (cooling)
; M116 ; Wait for all temperatures
M140 S0 ; turn off Bed
M117 Pickup piece
M300 s2500 p400 ; Beep
M300 s2000 p400
M300 s1500 p400
M300 s1000 p400
M84 ; Disable motors
M117 Printer ready
  • Extruder 1 - Nozzle diameter: 0.4mm
  • Extruder 1 - Retraction length: 2
  • Extruder 1 - Retraction Speed: 40mm/s
Now you should be good to go and print some parts.

Friday, 17 June 2016

Hiding the mouse cursor in Kodi

I use Kodi with a touchscreen and wanted to hide the mouse cursor, but NOT disable mouse input. This can be done by using a 1x1 transparent PNG file as the mouse cursor. Find out what skin you're using and where your skin directory is. For me this is estouchy and its directory is /usr/share/kodi/addons/skin.estouchy. You need to download the PNG first:

wget https://upload.wikimedia.org/wikipedia/commons/c/ca/1x1.png

Then move it to the skins media directory (or where ever the skin gets its cursors from):

sudo mv 1x1.png /usr/share/kodi/addons/skin.estouchy/media/pointer_1x1.png

Then edit the Pointer.xml file:

sudo nano /usr/share/kodi/addons/skin.estouchy/xml/Pointer.xml

And replace all "width" and "height" values with 1 and all "texture" values with the name of the 1x1 texture:

<width>1</width>
<height>1</height>
<texture>pointer_1x1.png</texture> 

Now your cursor should be invisible.

Thursday, 16 June 2016

Properly setting up a 5" HDMI touchscreen for Kodi on Raspbian

Wow. This was a royal pita. I wanted to build this wake-up-light-alarm-clock-media-thingy for my girlfriend. Well, I got my hands on a RPi Zero and needed an LCD display. I found this nice-looking "WaveShare 4" IPS display" on Ebay and spent days trying to get it to work properly. You want a hint? DONT DO IT! BUY A HDMI SCREEN! Refresh rate sucks, Kodi is not working with hardware-acceleration, Framebuffer copying never worked. Short: It sucked!

So. Next chapter: Bought a 5" HDMI screen here. It has an HDMI input and connects to the RPi GPIO pins for power and touch functionality... and works ALMOST out of the box on a fresh Raspbian install (from 5/2016). Nice!

Set up screen resolution and touchscreen

 

 Edit /boot/config.txt:

hdmi_force_hotplug=1
hdmi_group=2
hdmi_mode=87
hdmi_cvt 800 480 60 6 0 0 0


dtparam=spi=on
dtoverlay=ads7846,penirq=25,speed=10000,penirq_pull=2,xohms=150


This gets the display and the touchscreen up and running. You can test if the touchscreen does anything using:

cat /dev/input/mouse0
or
cat /dev/input/event0
 

Setting up the touchscreen for X

 

This should give you weird output whenever you touch the screen. Fine.
Now you want to calibrate it. To do that install the calibration utility:

sudo apt-get install xinput_calibrator

Then start the GUI. You should now have an entry "Calibrate touchscreen" in your menu. Start it and tap the points. When finished the screen should be calibrated.
Or, to do the calibration from the command line, run:

xinput-calibrator

You can also do this from SSH, if you don't have a keyboard attached:

DISPLAY=:0 xinput_calibrator

Tap the points and when finished, the tool will output some calibration information:

Section "InputClass"
        Identifier      "calibration"
        MatchProduct    "ADS7846 Touchscreen"
        Option  "Calibration"   "114 3982 226 3883"
        Option  "SwapAxes"      "0"
EndSection


Paste the calibration info into "/usr/share/X11/xorg.conf.d/99-calibration.conf".

Setting up the touchscreen for Kodi

 

Now you have a calibrated X input device, so the Desktop works nicely, but Kodi still does not. When starting it from X, there is a cursor, but the calibration is way off. When starting it standalone, there is not even touch input...
Fix this by installing tslib and evtest:

sudo apt-get install evtest tslib libts-bin 
 
Additionally you will need Then calibrate the touchscreen using:

TSLIB_TSDEVICE=/dev/input/event0 ts_calibrate

Touch the 5 crosses and you're done. You can test the calibration using:

TSLIB_TSDEVICE=/dev/input/event0 ts_test

You might also need to add the "kodi" user to the "input" user group:

sudo usermod -a -G input kodi

If you have Kodi version >= 17 ("Krypton") you cannow set up scale factors for the display so the cursor is properly displayed.

Setting display scale factors in Kodi >= v17

 

Test if Kodi can use touch input now. Start Kodi and touch the upper left corner of the screen. You will see a cursor and can move it, but only in 1/5th of the screen. The problem is that the coordinates /dev/input/event0 sends are touch device coordinates (in the range you see in the calibration values above), but Kodi expects pixel screen coordinates (0-800,0-480). Kodi starts to support touchscreen calibration out-of-the-box as of v17 aka "Krypton".
Edit the file advancedsettings.xml in your users userdata folder, e.g. /home/kodi/.kodi/userdata or ~/.kodi/userdata. If it does not exist, create it and add the following entries:

<advancedsettings>
    <touchscreen>
        <x_offset>-32</x_offset> <!-- cursor pixel x offset
        <y_offset>-35</y_offset> <!-- cursor pixel y offset
        <x_stretch_factor>0.209</x_stretch_factor> <!-- stretch factor
        <y_stretch_factor>0.131</y_stretch_factor> <!-- stretch factor
    </touchscreen>
</advancedsettings>


Good start values can be calculated by dividing the screen resolution by the X11 calibration values above (e.g. for x: 800/3982=~0.2 and 480/3883=~0.124). Note that you have to restart Kodi after editing the values to see any changes.

Installing a touchscreen calibration fix

 

When you have an older Kodi version and can not use advancedsettings.xml, there are also ways to properly calibrate your screen. Read here about using a tslib fork and ts_uinput_touch for this.

Fixing the double-click issue


A remaining problem is that Kodi wants a double-click to activate a function. This is not good as we want to activate functions with a single click or tap. We can change this by editing the file /usr/share/kodi/system/keymaps/mouse.xml. Change the entries in the mouse section to:

<mouse>
  <leftclick>leftclick</leftclick>
  <rightclick>rightclick</rightclick>
  <middleclick>middleclick</middleclick>
  <doubleclick id="0">noop</doubleclick>
  <longclick id="0">contextmenu</longclick>
  <wheeldown>wheeldown</wheeldown>
  <wheelup>wheelup</wheelup>
  <mousedrag>mousedrag</mousedrag>
  <mousedragend>leftclick</mousedragend>
  <mousemove>noop</mousemove>
</mouse>



P.S. Find out how to hide the cursor here.
P.P.S. You can also add backlight control to the screen...

Wednesday, 15 June 2016

Adding GPIO PWM backlight control to a 5" HDMI screen (and Kodi)

So the screen from here is working in Kodi now, but it draws a lot of power when the backlight is on (~200mA). We want to turn at least the backlight off, leaving the touchscreen active so we can interact and wake it up again. Buuut the LCD has no backlight control which is a pity (would have cost only cents). Good thing is: We can easily add it.
What you'll need:
  • IRF7104 P-Channel MOSFET
  • 10 kOhm resistor
The displays backlight power supply runs on 5V and already has an on/off switch. We cut the trace leading from the switch to the backlight power supply circuit:


Then solder the IRF7104 there (pin 3 (Source) right, pin 6 (Drain) left). Pin 1 of the MOSFET is the pin next to the little dent. The IRF will switch power to the backlight on and off and should handle currents of up to ~1.5A.
Now we need a circuit to connect the Gate (pin 4) of the MOSFET to the GPIO pin. I used GPIO #18 / PWM0 (pin 12) on my RPi Zero. NOTE: This pin may be connected to the audio out on other RPis, so you might need to choose a different pin...
We connect the Gate pin to a 10k Ohm resistor and connect that to our GPIO pin. The final circuit is in the image below:


Now when you start the RPi it should turn the screen on by default. You can use the commands:

gpio -g mode 18 out
gpio -g write 18 1

to turn the screen off. You need WiringPi for that, so if you don't have it, install it... To control backlight brightness by PWM you can do:

gpio -g mode pwm
gpio -g pwm 18 x (x takes values from 0 (full on), to 1023 (off))

To turn the screen back on do:

gpio -g mode 18 out
gpio -g mode 18 0

For the following instructions, use the home directory of the user you want to run Kodi from. If you make Kodi autostart by editing /etc/default/kodi, this is the user "kodi" (used here), else it is probably the user "pi".

Now to integrate support for the backlight into Kodi, we need to run those commands when the Kodi screensaver starts or ends. For that we need a service addon called "service.xbmc.callbacks". Download the script from the releases section and unzip it into /home/kodi/.kodi/addons. Then create two script files in the /home/kodi directory:

screen_off.sh:
#!/bin/sh
gpio -g mode 18 out
gpio -g write 18 1


screen_on.sh:
#!/bin/sh
gpio -g mode 18 out
gpio -g write 18 0

Make those scripts executable:

chmod +x screen_on.sh screen_off.sh

Now start Kodi and add those two scripts in the addon configuration for screensaver start / exit:


Your backlight should now turn off / on with the screen saver.

Saturday, 23 April 2016

Building a mobile magnet lamp / flashlight from repurposed parts

I needed a mobile "flashlight" in my car you could simple attach somewhere to the chassis where you'd need it. The are plenty of offers on the interwebs, so could have simply bought one, but I (as usual) had some parts lying around...
I had:
  • A spare 12Wh Li-Ion battery left over from my Kodi car entertainment project.
  • Two broken 1W 12V LED "bulbs", meant as Halogen bulb replacements.
  • Some magnets from old computer harddisks.
I knew I could build lamp with that. For the final design I also used:
First thing were the LED lamps. The glass and plug were shattered, but electrically they were ok. I tested them and one of them turned on at ~4V. I desoldered the regulator PCB disc from the other one and connected the + and - regulator output terminals from the one that still had the regulator PCB to the other one. While I was at it I removed the rectifier diodes. The are not needed when you use DC and connect the leads correctly. It worked, but the LEDs weren't bright enough. The regulator is a constant current supply and thus it still delivered the same amount of current to two parallel LED arrays now. The chip used is a XL6003 LED constant current driver. The typical application circuit in Figure 5 from the data sheet seemed to match my PCB. The resistor RS used to adjust the current had a value of 5.6 Ohm. The calculations in the datasheet of RS = 0.22 / ILED worked just as an estimate for me, so after some testing I settled on a 10 and 4.7 Ohm resistor in parallel = 3.2 Ohm, which almost doubled the current.


UPDATE: You can simply connect the battery to the lamp input! No step-up regulator needed! This makes the runtime even longer! The lamp will grow dimmer when the Li-Ion voltage drops and I've not seen it go below ~3.2V.
I've added a 100 Ohm potentiometer in series to the combined 3.2 Ohm resistor so you can adjust the brightness really easy.

Then I built a shutdown circuit for the 5V step-up regulator U1V11F5 to turn off power to the LEDs when the Li-Ion voltage drops below ~3.2V to save the battery from dying. The regulator has a SHDN pin to turn it on/off. For > 1.5V input voltage you have to apply < 0.4V to the SHDN pin to turn the regulator off and > 1.2V to turn it on. The pin is already internally connected to VIN through a 100 kOhm resitor and thus floats at input voltage and turns on the regulator by default. The shutdown circuit:


You can find the simulation project here, but note that the simulation is not 100% correct, because the transistor model does not use the proper BC557C values. The rightmost resistor is the regulators internal 100 kOhm resistor. The pin connected to the volt meter (transistor collector) should be connected to the U1V11F5 SHDN pin.
Edit: When testing the lamps maximum running time I found it would not reliably shutdown with a 22 kOhm resistor. You may need a lower value to make the lamp shut down earlier. Also the XL6003s is rated down to 3.6V input voltage, so I will try connecting the battery directly and see if it shuts down by itself anyway...


The rest is just connecting the charger to the Li-Ion battery, connecting a switch to turn on/off power to the circuit above and the regulator, and then connecting the regulator VOUT pin to the LED PCB input pin.


Voila, a mobile Li-Ion lamp. I think I'll build a nice wooden enclosure for it...

Friday, 25 March 2016

Building a Kodi in-car entertainment system using a Motorola Atrix Lapdock and an Odroid C0

Watching movies in the car is great fun. It is even better when you have a camper and lie in your comfy sleeping bag - I needed an in-car entertainment system.
I have a stereo in the car already that can even play videos, but the screen is small, codec support is limited and it is in the front whereas you're sleeping in the back. Tablets with big screen are expensive and have rather bad sound quality. Also I still had this Motorola Atrix Lapdock lying around I wanted to use for a build and try out the Odroid C0 board.
The Lapdock is nice for a Raspberry Pi like SoC. It is basically a 11.5" HDMI screen with a 1366x768 resolution, a touchpad and keyboard, speakers (audio via HDMI), 2-port-USB-hub, and a 36Wh 3-cell Li-Ion-battery built in. It originally connected to a smartphone via a male micro-USB and micro-HDMI plug. To connect the Lapdock to a computer you'll most likely need a micro-HDMI-D (female) to HDMI-A (male) adapter. It comes with a 19V AC/DC power supply, but wanted to power it from the 13V car battery. I had to butcher it...
Taking apart the thing is not so hard. It is the usual small-screws-and-plastic-clips system all laptops use. When you're done the "mainboard" looks like this:


You find the battery connected to a 6-pin connector labeled "JP2". The system needs a 3.3V and >5.5V power supply. The 5.5V voltage sounds strange, but it was measured when the system ran via the 19V AC/DC adapter. With anything below 5.5V USB devices might not work, because then USB supply voltage is < 3.3V and most USB devices do not work below that. I found 5.6V to work fine. Here's the pinout of JP2:


Supplying power is not enough to make the Lapdock display turn on. When you have disconnected the touchpad cable it will not turn anymore, because the touchpad has a reed switch or hall sensor that detects when the Lapdock lid is closed or opened. If you want the mainboard and display to turn on immediately when you supply power, simply bridge two pins on the JTP1 connector:


Bridge the pins marked in green and blue here.
Audio can be sent to the Lapdock via HDMI, so make sure your SoC supports that. The Lapdock has a small audio amplifier that drives the microscopic built-in speakers. If you want to route audio to a better amplifier etc. you have to tap the pins on the APA2031 audio amplifier IC. The typical application circuit from the specs give a hint on where to find the audio signals. The left channel is on LIN- (pin 5), the right one on RIN- (pin 17). GND can be found in a lot of places:


I connected a switch to the pins, so can either use built-in speakers or route audio to the main stereo for better sound quality. Soldering to the IC pins can be quite a pita, because it's quite small...
Now you should be mostly ready to roll. On to the Odroid C0.

The Odroid C0 is a small board sporting an Amlogic S805 1.5GHz dual-core SoC with a Mali 450MP2 GPU (decodes H265/HEVC) and 1GB of DDR3 RAM. The board is as bare-bone as it gets, having only a power and HDMI connector, which gives it a great form-factor. You should order a heat sink though and maybe the connector kit if you want to add a USB-connector, GPIO pins or the IR receiver. If you want a board version with all connectors and Gigabit Ethernet, go with the C1+ which has the same SoC. Hardkernel also sells a small remote for the IR receiver which works quite well (and even out-of-the-box) with the Hardkernel Lubuntu 14.04.03 image.
What is really important though is to get an SD card that works with the board! Not all cards do. Make sure you read this and this before you buy one!
Copying the image to the SD card can be done in Linux with a simple:
sudo dd if=<THE_IMAGE_FILE> of=<YOUR_SDCARD_DEVICE>; sync
Don't forget to properly unmount the card. Now insert the SD card into the device and supply power. On the first boot the image is expanded to the whole card, so give it some time and wait for the C0 to reboot. Now you are greeted with a LXDE desktop. You can adjust the display settings via the "odroid utility". The natural choice would be 1360x768, but that gave me wrong colors and a screwed-up display, but I found 720p to work well. If you know how to use the native 1366x768 resolution, let me know in the comments. The utility also lets you update the kernel and firmware to a current version. Kodi is already installed and can be auto-started by adding it to the Desktop preferences. See here how.
The end result looks like this, and yes, it still needs an enclosure:


Monday, 18 May 2015

Using the Easybox 803A (Arcadyan ARV752DPW22) with OpenWRT 14.07 / 15.05

The Vodafone Easybox 803A has nice router hardware. I found one on the trash recently and decided to put OpenWRT on it. Here's how. This is based on the instructions found in the OpenWRT wiki, the OpenWRT forum and random bits on the net.

UPDATE2: I have updated the post to make it clearer what to do, but please read this WHOLE POST to understand what's going on technically! If you are not sure, read it again...

UPDATE: I updated the router to OpenWRT 15.05 "Chaos Calmer" and it works just fine. You can get the binaries here. If you have already installed 14.07 you can just update via the router firmware upgrade page in the web interface.

I used Ubuntu 14.04 and did most image uploads using ubootwrite.py, because everything else didn't work reliably for me, especially with older U-Boot versions. Also note that the U-Boot version contained in OpenWRT 12.09 (~2010.03) does not work with any of the LAN functions (BOOTM, ARP, TFTP). You have to use a newer version of U-Boot for this to work or use ubootwrite.py to upload via the serial port. Note that depending on your configuration you might need to prepend commands using the serial port with "sudo". I made a package with the binaries I've used. This is OpenWRT 14.07 Barrier Breaker release for the ARV752DPW22 and includes the bootloader, a backup booloader in ASCII format for restoring via UART and the actual OpenWRT image.
Please refer to the original OpenWRT page for additional instructions and images.

First part: Preparing a stock Easybox 803A for OpenWRT

Please note:
[bl] = Original/stock ARV752DPW22 bootloader
[ub] = U-Boot
[lo] = Local PC

Dumping your original firmware

This is really the first thing you should do. You do need parts of it later (the board configuration area) and it might come in handy to have a backup! The stock firmware has a BRN bootloader.
  • [lo] Download brntool using git: 'git clone http://github.com/rvalles/brntool'.
  • [lo] Change to directory: 'cd brntool'
  • Connect your USB to serial adapter to the router.
  • [lo] Start CuteCOM serial terminal: 'cutecom &'
  • Open the port (115200 Baud, 8 data bits, 1 stop bit).
  • Power-cycle / power up the router.
  • [bl] Be quick to press SPACE three times to stop the router from booting. Then press '!' to get into administration mode.
  • Close CuteCOM or disconnect it from the port so that brntool has access to it.
  • [lo] Dump the firmware: 'sudo python brntool.py --read=ARV752DPW22_orig.dump --addr=0xB0000000 --verbose --size=0x800000'
  • This will take some time (~1 hour). When finished, power-cycle the router
  • [bl] Be quick to press SPACE three times to stop the router from booting. Then press '!' to get into administration mode.
  • [lo] Dump the firmware again: 'sudo python brntool.py --read=ARV752DPW22_orig2.dump --addr=0xB0000000 --verbose --size=0x800000'
  • [lo] Compare the two firmwares (should give NO output): 'diff ARV752DPW22_orig.dump ARV752DPW22_orig2.dump'
  • [lo] If both files are the same, remove one of the files: 'rm ARV752DPW22_orig2.dump'
  • [lo] Extract the WiFi configuration from the original firmware: 'dd if=ARV752DPW22_orig.dump bs=1 skip=$((0x7f0000)) count=$((0x10000)) of=ARV752DPW22_orig_boardconfig.dump'

Load U-Boot into RAM and execute it

  • Power-cycle / power up the router and open the serial port.
  • [bl] Be quick to press SPACE three times to stop the router from booting. Then press '!' to get into administration mode.
  • [bl] Choose '[M] Upload to memory' and the default adress 0x80002000.
  • Close serial terminal or disconnect it from the port so that sx has access to it.
  • [lo] Send U-Boot image via XMODEM: 'sx IMAGE_FILE_NAME <USB_DEVICE >USB_DEVICE'
USB_DEVICE = Path to your USB to serial converter, e.g. /dev/ttyUSB0.
IMAGE_FILE_NAME = The image file you want to upload. I used the bootloader from "openwrt-lantiq-arv752dpw22_brn-u-boot.img" (2nd stage bootloader for brnboot).
  • When finished sx will tell you the amount of bytes uploaded. Convert this to hexadecimal to use it for copying to flash in later steps.
  • [bl] When done, open the port again in CuteCOM and press ENTER.
  • [bl] Choose '[Y] Go to memory' and the default adress 0x80002000.
  • [ub] U-Boot will now start. Press ENTER quickly to prevent it from trying to load the kernel.
You could now, if you want, upload the U-Boot image "openwrt-lantiq-arv752dpw22_nor-u-boot.img" (standalone bootloader) into the flash to overwrite the stock bootloader or use the in-memory U-Boot to load an OpenWRT image, put it into flash and start it. I'd go the route of first putting U-Boot into flash, but please note that if this fails your booloader is broken and the router won't boot anymore. You will have to put it into UART mode to revive it!

Copy U-Boot image into flash

  • [ub] Turn off flash protection: 'protect off all'
  • [ub] Erase flash before writing: 'erase 0xb0000000 +IMAGE_SIZE'
  • [ub] Write image into flash: 'cp.b 0x80040000 0xb0000000 IMAGE_SIZE'
0xb0000000 = For U-Boot / bootloader images, use 0xb0000000, for OpenWRT images use 0xb0020000 (OpenWRT 12.09) resp. 0xb0040000 (OpenWRT 14.07 and later)
IMAGE_SIZE = The size of the image / file you've uploaded as a hexadecimal number, e.g. 0x........ You will get this e.g. from the sx command line program or ubootwrite.py after uploading.
  • Now if you power-cycle the router the new U-Boot version should start automatically.
You are done with the first necessary steps to get a working U-Boot bootloader into flash. Now that you have done that, use one of the two following methods to copy and flash an OpenWRT image to the device:

Second part: Installing OpenWRT on the Easybox 803A

A: Upload new U-Boot or kernel image using U-Boot with ubootwrite.py

  • Connect to terminal and boot into U-Boot bootloader (press ENTER after booting).
  • Close serial terminal or disconnect it from the port so that ubootwrite has access to it.
  • [lo] Get ubootwrite.py script
  • [lo] Write the data to the device RAM: 'sudo python ubootwrite.py --serial=USB_DEVICE --write=IMAGE_FILE_NAME --addr=0x80040000'
--addr=... is the adress where to put the data. Use 0x80040000 as a safe value in memory BEHIND the booloader. Otherwise you would be overwriting the booloader...
IMAGE_FILE_NAME = The image file you want to upload. I used the OpenWRT image "openwrt-lantiq-xway-ARV752DPW22-squashfs.image".
  • When finished ubootwrite will spit out a CRC32 value you should check, and a hexadecimal image size you can use to copy the image into flash.

B: Upload new U-Boot or kernel image using XMODEM

  • Connect to terminal and boot into U-Boot bootloader (press ENTER after booting).
  • [ub] Load data to RAM using XMODEM: 'loadx 0x80040000'
  • Close serial terminal or disconnect it from the port so that sx has access to it.
  • [lo] Send data using XMODEM: 'sx IMAGE_FILE_NAME <USB_DEVICE >USB_DEVICE'
IMAGE_FILE_NAME = The image file you want to upload. I used the OpenWRT image "openwrt-lantiq-xway-ARV752DPW22-squashfs.image".
  • When finished sx will tell you the amount of bytes uploaded. Convert this to hex to use it for copying to flash.
Now that you have a you have the data in RAM you can copy and flash it to the device...

Copy uploaded image into flash

  • [ub] Turn off flash protection: 'protect off all'
  • [ub] Erase flash before writing: 'erase 0xb0000000 +IMAGE_SIZE'
  • [ub] Write image into flash: 'cp.b 0x80040000 FLASH_ADRESS IMAGE_SIZE'
FLASH_ADRESS = For U-Boot / bootloader images, use 0xb0000000, for OpenWRT images use 0xb0020000 (OpenWRT 12.09) resp. 0xb0040000 (OpenWRT 14.07 and later)
IMAGE_SIZE = The size of the image / file you've uploaded as a hexadecimal number, e.g. 0x........ You will get this e.g. from the sx command line program or ubootwrite.py after uploading.

Now if you power-cycle the router and don't interrupt the boot process, OpenWRT should start. Let it start completely one time until no more new messages appear on the terminal and see something along the lines "init complete". OpenWRT will have extracted the squashed image to flash (you see messages like "erasing all blocks after the end marker... done."). This will possibly overwrite the WiFi configuration area that you must rewrite to the device for WiFI to work. This only muste be done if you flash OpenWRT via uboot and not when you upgrade OpenWRT via the web interface:

Rewrite WiFi configuration area to device

  • Connect to terminal and boot into U-Boot bootloader (press ENTER after booting).
  • Close serial terminal or disconnect it from the port so that ubootwrite has access to it.
  • [lo] Write configuration area to RAM: 'sudo python ubootwrite.py --serial=USB_DEVICE --write=ARV752DPW22_orig_boardconfig.dump --addr=0x807f0000'
  • Connect to terminal again.
  • [ub] Turn off flash protection: 'protect off all'
  • [ub] Erase flash before writing: 'erase 0xB07f0000 +0x00010000'
  • [ub] Write image into flash: 'cp.b 0x807f0000 0xB07f0000 0x00010000'
  • Power-cycle the router.
If WiFi is still not working after this, reset the router configuration using the LuCI tool / Router Web-GUI.