HydraNFC

From YobiWiki
Jump to navigation Jump to search

Some personal notes...

HydraBus

Links

Getting firmware sources

See here. Personally I prefer a slightly different approach:

sudo apt-get install git dfu-util python python-git
cd .../path_to_hydrabus
wget http://www.bialix.com/intelhex/intelhex-1.4.zip
unzip intelhex-1.4.zip
cd intelhex-1.4
python setup.py install --user
cd .../path_to_hydrabus
wget https://launchpad.net/gcc-arm-embedded/4.7/4.7-2013-q3-update/+download/gcc-arm-none-eabi-4_7-2013q3-20130916-linux.tar.bz2
tar xjf gcc-arm-none-eabi-4_7-2013q3-20130916-linux.tar.bz2
git clone https://github.com/bvernoux/hydrafw.git hydrafw
cd hydrafw
git submodule init
git submodule update

Compiling firmware

cd .../path_to_hydrabus
export PATH=$PATH:$(pwd)/gcc-arm-none-eabi-4_7-2013q3/bin
cd hydrafw
make clean
make

Flashing firmware

This works only from USB1, not USB2!!

Since v0.5-beta, no need for wires, just press UBTN at PowerOn/RESET:

  • ULED blinks in normal mode and stays ON in DFU mode
cd .../path_to_hydrabus
cd hydrafw
sudo dfu-util -a 0 -d 0483:df11 -D ./build/hydrafw.dfu

For older firmware or if the device gets "bricked" (e.g. bad usb while flashing), UBTN is not working, do it the old way:
Connect HydraBus pin BOOT0 to 3V3 and BOOT1 to GND (using a dual female splittable jumper wire) to enter USB DFU and connect microUSB (USB1) to PC (see image)
After flashing, disconnect 'BOOT0 to 3V3' and 'BOOT1 to GND' and power cycle or reset board

Getting ready to use HydraBus

sudo apt-get install screen
cat |sudo tee /etc/udev/rules.d/09-hydrabus.rules << EOF
# UDEV Rules for HydraBus boards, http://www.hydrabus.com
# Avoid modem-manager to mess with this device:
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="5740", ENV{ID_MM_DEVICE_IGNORE}="1"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="5740", MODE="0664", GROUP="plugdev"
EOF
sudo udevadm trigger

Users members of plugdev group are now ready to use HydraBus

Using HydraBus

Connect microUSB (USB1 or USB2) to PC

screen /dev/ttyACM0

"h" for help, TAB for autocompletion

HydraBus UART

Some notes on the high speed UART:
USART1 (pins PA9=TX & PA10=RX) is able to run up to 10.5M bauds
For high baudrates you need a very recent firmware to fix a bug in ST drivers, otherwise only a few values will work as expected (2.1M, 2.625M, 3.5M, 5.25M)
Usage:

uart1> speed 5000000
Final speed: 4941176 bps(1.19% err)
uart1> write 0x61:10
WRITE: 0x61 0x61 0x61 0x61 0x61 0x61 0x61 0x61 0x61 0x61 

FTDI C32HM-DDHSL-0 cable

To use high baudrates, one can use e.g. the FTDI C32HM-DDHSL-0 cable.
Connection to hydrabus UART1:

  • yellow ADBUS1 RX - PA9 USART1 TX
  • orange ADBUS0 TX - PA10 USART1 RX
  • black GND - GND

From a few tests I ran with a Picoscope as independent reference to measure the actual baudrates on the wires, the FTDI works reliably up to 6.1M, then setting values such as 6.3M will actually give 8.55M and settings of 8.3M and above will be silently downgraded to 115200.

So one can reliably use hydrabus & FTDI at 6M bauds, maybe 8.5M if done cautiously (setting FTDI at 6.3M).

FTDI C32HM-DDHSL-0 under Linux

Under Linux it's quite cumbersome to set arbitrary baudrates, see https://stackoverflow.com/questions/12646324/how-to-set-a-custom-baud-rate-on-linux

  • stty accepts only the following baudrates above 115200: 230400, 460800, 500000, 576000, 921600, 1000000, 1152000, 1500000, 2000000, 2500000, 3000000, 3500000 and 4000000.
stty -F /dev/ttyUSB0 4000000
cat /dev/ttyUSB0
  • putty accepts everything but will configure to the closest match from stty/termbits list.
  • screen accepts everything but downgrade to 9600 if not 230400 or 460800.
  • maybe one can try to code its own term with the arbitrary baudrate trick...

FTDI C32HM-DDHSL-0 under Windows

under Windows 7 with putty, any baudrate up to 6M is possible, higher values lead to other measured values as explained above (e.g. set 6.3M = measured 8.55M)

HydraNFC

HydraNFC must be plugged on the front side of HydraBus!

Links

Sniffing

  • "nfc_sniff" or press K3
  • Press K4 to interrupt

If a MicroSD is present, it will automatically save the trace in a txt file