Friday, June 8, 2012

v-USB + I2C . debugging the debugger

8-6-2012
Going to implement the usb data link so that it can be used to debug the I2C slave device.

Learning the parts of V-USB and how to use it.

http://vusb.wikidot.com/driver-api

9-6-2012
Got an HID-keyboard device running. So, can make the program simply type out the report (for now) instead of making a program that processes the incoming data.

wrote a program using which strings and numbers can be easily "typed" through USB.


Going damn crazy trying to debug the I2C !!!!!!!!!

9-6-2012

Got it kinda working. Not sure what the exact problem was but I had forgotten put the usbpoll() into the main loop, so any excessive delays would've meant the USB lost connection. Also, converted the slave to a polled I2C system since I was worried that the interrupts might interfere with the USB timing sequences.

On the master side, the interrupt based code still seems to have some bug.

Just found another AVR usb implementation lib http://dicks.home.xs4all.nl/avr/usbtiny/
And another! http://www.fourwalledcubicle.com/files/LUFA/Doc/100513/html/main.html


Seems that the code simply refuses to jump to the ISR!

http://wiki.msoe.us/ce2810/interrupts
http://www.nerdkits.com/library/codelib_asyncI2C/

really driving me nuts!! ( 12:26 AM 10-6-2012 )

10-6-2012

TWSTA must be cleared by software!!!
TWINT must be 0 when waiting for the new data to be written to TWDR. So make sure that while you wait, ie. when TWIE is disabled, TWINT is cleared too!!!

(10-6-2012 8:19 PM)
SO HAPPY! Got the I2C to successfully send a sequence of numbers with interrupt based Master(Robot) and polled slave(USB device)

Now, have to implement a protocol by which the robot reports the data stucture that will be sent and make the slave read and print in that format. Also need to build support for sending 16 bit data across I2C.

No comments:

Post a Comment