Shield address change

Add RS-422 to a Controller node
rpu_bus
Posts: 208
Joined: Sun Sep 18, 2016 6:07 pm

Shield address change

Postby rpu_bus » Sat Mar 11, 2017 1:46 pm

The RPUadpt (e.g. DUT) shield address with Remote firmware defaults to '1' and is changed with i2c-debug.

To do the change an ICSP tool is used, and then a host connection from a RPUftdi board with Remote2Host firmware and some ATmega328p MCU boards.

Install the toolchain and clone these three repositories.

Code: Select all

cd ~
sudo apt-get install git gcc-avr binutils-avr gdb-avr avr-libc avrdude
git clone https://github.com/epccs/RPUadpt
git clone https://github.com/epccs/RPUftdi
git clone https://github.com/epccs/RPUno


Plug the RPUftdi onto a MCU board. Power both boards with a USB connection to the RPUftdi.

Set the fuse on RPUftdi (if needed). Connect the ICSP tool to the RPUftdi and run the Makefile rule to set the bus manager fuse.

Code: Select all

cd ~/RPUftdi/Bootload
make fuse


Load the Host2Remote firmware

Code: Select all

cd ~/RPUftdi/Host2Remote
make isp


Plug the RPUadpt into a second MCU board. Connect power to the second MCU board, it also needs to power the RPUadpt. Connect the ICSP tool to the RPUadpt bus manager to set the fuse on it.

Code: Select all

cd ~/RPUadpt/Bootload
make fuse


Load the Remote firmware

Code: Select all

cd ~/RPUadpt/Remote
make isp


That is it for the ICSP tool (unless the bootloader is needed on MCU board).

The default bootload address for Host2Remote is '0', which is its own address. Load the i2c-debug firmware onto the first MCU board through the RPUftdi.

Code: Select all

cd ~RPUno/i2c-debug
make bootload


Now change the bootload address to '1'. Connect with picocom and set the byte that is sent when DTR/RTS toggles ('1' is 0x31 or 49).

Code: Select all

~$ picocom -b 38400 /dev/ttyUSB0
...
/0/address 41
{"address":"0x29"}
/0/buffer 3,49
{"txBuffer":[{"data":"0x3"},{"data":"0x31"}]}
/0/read? 2
{"rxBuffer":[{"data":"0x3"},{"data":"0x31"}]}


Exit picocom with C-a, C-x. This is now the bootload address that is broadcast when avrdude runs.

To check this use picocom to connect. The RPUadpt's red MNG_LED blinks when the bus manager is addressed over the DTR pair. Exit picocom with C-a, C-x. The MNG_LED should stop blinking after picocom exits.

Now load the i2c-debug firmware onto the second MCU board under the RPUadpt.

Code: Select all

cd ~RPUno/i2c-debug
make bootload


The RPUadpt shield address with Remote firmware defaults to '1' and is changed with i2c-debug. The i2c-debug program reads the address during setup, so it will need a reset, remember to change the RPUftid broadcast address to '2', so the RPUadpt will reset it's MCU board.

Code: Select all

~$ picocom -b 38400 /dev/ttyUSB0
...
/1/id?
{"id":{"name":"I2Cdebug","desc":"RPUno Board /w atmega328p and LT3652","avr-gcc":"4.9"}}
/1/scan?
{"scan":[{"addr":"0x29"}]}
/1/address 41
{"address":"0x29"}
/1/buffer 1,50
{"txBuffer":[{"data":"0x1"},{"data":"0x32"}]}
/1/read? 2
{"rxBuffer":[{"data":"0x1"},{"data":"0x32"}]}
/0/address 41
{"address":"0x29"}
/0/buffer 3,50
{"txBuffer":[{"data":"0x3"},{"data":"0x32"}]}
/0/read? 2
{"rxBuffer":[{"data":"0x3"},{"data":"0x32"}]}


Exit picocom with C-a, C-x, then start it again to broadcast address '2', which will cause the RPUadpt to reset it's MCU board and the i2c-debug program will read the address.

Code: Select all

~$ picocom -b 38400 /dev/ttyUSB0
...
/2/address 41
{"address":"0x29"}
/2/buffer 0,255
{"txBuffer":[{"data":"0x0"},{"data":"0xFF"}]}
/2/read? 2
{"rxBuffer":[{"data":"0x0"},{"data":"0x32"}]}

Return to “RPUadpt”

Who is online

Users browsing this forum: No registered users and 1 guest