Martin's corner on the web

Funky v2 as RFM12B to Raspberry Pi gateway

Funky v2 enumerates as a CDC device when plugged in to your Raspberry Pi without the need of any driver, so it is pretty easy to get it working as a RFM2Pi board. Useful If you decide that for some reason you need Raspberry Pi’s GPIO header free. Simply upload this sketch, plug the Funky v2 into your Raspberry Pi and it will start responding at /dev/ttyACM0 (the RFM2Pi board talks back at /dev/ttyAMA0); You will have to change the port on couple instances, just check the wiki and look for AMA0 to replace with ACM0 instead.

Uploading sketches from Raspberry Pi using avrdude is also piece of cake, you need a simple python script to kick the Funky into bootloader mode (by opening and closing the serial port at 1200 baud)

#!/usr/bin/python
#!/usr/bin/env python

import serial, sys
serialPort = sys.argv[1]
print serialPort

ser = serial.Serial(
    port=serialPort,
    baudrate=1200,
    parity=serial.PARITY_NONE,
    stopbits=serial.STOPBITS_ONE,
    bytesize=serial.EIGHTBITS
)

ser.isOpen()
ser.close()             # close port

Use it by running ‘python reset.py /dev/ttyACM0’. That will give you 8 seconds window within which you need to run avrdude:

avrdude -patmega32u4 -cavr109 -P /dev/ttyACM0 -b57600 -D -Uflash:w:some_sketch.hex:i

Easy, right?

IMG_2017