**** BEGIN LOGGING AT Sat Jul 16 23:59:56 2005 Jul 17 18:36:42 [g2], ping Jul 17 19:02:05 <[g2]> VoodooZ, pong Jul 17 19:04:40 Hey, Jul 17 19:04:52 Are you guys using USB on your JTAG project? Jul 17 19:05:33 <[g2]> ep1220 is Jul 17 19:06:07 I"m asking because I apparently managed to burn my I2C bus AGAIN! I have no clue what happened but the RTC is not responding anymore. Jul 17 19:06:48 So I'm considering building a USB hub using an AVR that will extend I/O out and read other sensors so my slug can read it all in one big chunk via USB. Jul 17 19:07:42 Have you reset the RTC? Jul 17 19:08:19 Irregardless. I rebooted and all and it still doesn't work with no other i2c devices on the bus. Jul 17 19:08:40 <[g2]> bummer :( Jul 17 19:08:42 I was just curious to know how hard it would be to code for USB data xfer Jul 17 19:09:02 I don't feel like buying another one when this one still works fine. Jul 17 19:09:19 I don't care much about time. I'm just afraid linux might not like it though. ??? Jul 17 19:09:24 It doesn't respond at all? Jul 17 19:10:06 nope. Jul 17 19:10:44 but that's ok as I always wanted to learn to program USB. Jul 17 19:11:10 I noticed quite a big frame rate drop when using the software I2C anyways so... Jul 17 19:11:56 Linux will be fine with the lack of RTC Jul 17 19:12:04 It will just start over at a fixed time each time you reboot Jul 17 19:12:11 good. Jul 17 19:12:41 I just hope it won't keep trying to access it until it times out as the bootup times is already long enough like that. :) Jul 17 19:13:07 Remove the RTC driver if you want to stop that Jul 17 19:13:18 ok. Jul 17 19:13:37 It will time out but it'll be faster just without it Jul 17 19:13:43 Should I have my robot code make USB calls or have the kernel do it. is this what libusb does? userspace? Jul 17 19:14:11 Yeah. libusb is a userspace library to talk to USB devices Jul 17 19:14:28 Is it actually 100% working now? I thought it was good enough for scanning now but there were still some underlying flaws? Jul 17 19:14:40 I heard bad things about it. Jul 17 19:15:14 so I guess I'd be better off writing an actual kernel driver module for my USB device and have my robot code mmap it right? Jul 17 19:15:22 You can do what puppy does and directly access usbfs Jul 17 19:15:23 look at puppy. Jul 17 19:15:24 That should work Jul 17 19:15:27 echo Jul 17 19:15:29 :-) Jul 17 19:15:31 :) Jul 17 19:15:44 mmap it? Jul 17 19:15:44 really? much simpler probably too right? Jul 17 19:15:47 ew Jul 17 19:16:14 I'll be mostly requesting a block of data every iterations of the sensor loop and then writing the motor commands out Jul 17 19:16:18 It's not as simple as just using libusb but it's easier than writing a whole driver Jul 17 19:16:31 ok. Jul 17 19:16:48 I'm starting to read about USB and how the protocol is handled. Jul 17 19:17:05 AVRs have built in USB? Jul 17 19:17:05 command packets vs the others and all... Jul 17 19:17:11 (Not looked at them recently) Jul 17 19:17:19 the newer ones apparently do Jul 17 19:17:28 You basically have multiple channels called endpoints (don't ask. it's a stupid name yes) Jul 17 19:17:35 Each one is only one direction Jul 17 19:17:43 but I might actually try that software based USB stack for the AVRs first. Jul 17 19:17:45 You can have 16 both ways. 0 is always the control channel Jul 17 19:17:48 i see. Jul 17 19:18:05 The AVRs have the required hardware though yes? Jul 17 19:18:11 So I would request one for reading and one for sending my motor commands. Jul 17 19:18:21 I wouldn't try interfacing one that doesn't have the USB hardware Jul 17 19:18:35 really? Jul 17 19:18:53 Yes. There are strict timing requirements Jul 17 19:19:05 I don't want to have one of those FTDI USB 2 serial chip thingy as they limit me. Jul 17 19:19:07 You can't just bitbang it out like serial Jul 17 19:19:36 yeah, but it works. It's limited to 1.5mbit but that's enough. It's still plenty fast comapred to 100Khz I2C. Jul 17 19:19:48 what works? Jul 17 19:20:06 the AVRUSB thing. check it out:http://www.obdev.at/products/avrusb/ Jul 17 19:20:30 There is another opensource one around too. Jul 17 19:20:43 and it even uses my favorite AVR! mega8. Jul 17 19:20:53 ew. bitbanged USB Jul 17 19:21:00 it is the slow one however Jul 17 19:21:08 Only mice and keyboards really use that speed Jul 17 19:21:11 slow what? USB mode? Jul 17 19:21:14 Yes Jul 17 19:21:28 Wouldn't that be plenty for motor commands at 20Hz? Jul 17 19:21:42 How tight are you timing requirements? Jul 17 19:21:45 are your Jul 17 19:21:57 I read sensors and write resulting motor commands every 40-60ms. Jul 17 19:22:03 Not that tight. Jul 17 19:22:07 It's okay if you miss it by a few ms however? Jul 17 19:22:14 I guess. Jul 17 19:22:29 Until I realise otherwise :) Jul 17 19:22:32 Should be okay then... Jul 17 19:23:03 It's not isosynchronous so you're not gauranteed when it will complete Jul 17 19:23:18 well, I'll give it a quite try anyways. cheaper and faster that buying a new AVR. Jul 17 19:23:23 Yeah Jul 17 19:23:24 that's fine. Jul 17 19:23:29 for now at least. Jul 17 19:23:52 so I'll check that puppy package then. Jul 17 19:24:00 Yup Jul 17 19:24:14 Your AVR run at 12MHz? Jul 17 19:24:19 and then If I feel more advanturous I'll write my own driver. Jul 17 19:24:23 16Mhz Jul 17 19:24:32 which is overkill in most cases. Jul 17 19:24:37 You'll have to change it for 12MHz Jul 17 19:25:04 Timing again Jul 17 19:25:05 yeah, but just the master one which will talk to the slug and fetch updates from all the sensors. Jul 17 19:25:41 I might have it read the sensors via I2C so it will essentially become a USB-to-I2C hub. Jul 17 19:25:47 Depending on how tight the timing requirements of the code are, you might need to dedicate a single AVR to do the USB and another one to do everything else. Not hard though and still cheap Jul 17 19:25:56 Depends on how much stuff you're actually doing Jul 17 19:26:10 yep. exactly what I wanted to do. Jul 17 19:26:16 not that much. Jul 17 19:26:27 What on earth are you doing to the I2C bus anyway?? Jul 17 19:26:36 I already have mega8's co-processors for most of my sensors Jul 17 19:26:45 and one on the motor controller. Jul 17 19:27:05 I have no clue yet. I must have zapped it with 5V by accident. Jul 17 19:27:14 It was too slow anyways. Jul 17 19:27:16 :) Jul 17 19:27:19 that's what you did the first time around though! Jul 17 19:27:29 you like wearing wool jumpers? :) Jul 17 19:27:33 yeah I know :( Jul 17 19:27:58 I noticed quite a performance dropped in my vision code when actually enabling the I2C read. Jul 17 19:28:20 so that will help motivate me to move to USB. Jul 17 19:28:27 which I was too lazy to do in the first place. Jul 17 19:28:38 Plus It's good experience. Jul 17 19:28:57 yeah Jul 17 19:29:26 you using a USB camera? Jul 17 19:29:37 yep Jul 17 19:29:41 usb 2.0! Jul 17 19:30:04 there was no driver so I had to hack the experimental one from a guy I found online. Jul 17 19:30:23 so I have good example code if I ever move to a kernel module. Jul 17 19:30:30 (for my I/O module) Jul 17 19:30:57 Use a FPGA ;) Jul 17 19:31:26 heheheh Jul 17 19:31:43 I know! that's another thing I want to try eventually. but It's overkill for now/ Jul 17 19:33:03 I just tried the RTC again (running on AC instead of battery this time) and it still fails so... Jul 17 19:33:14 <[g2]> Tiersten, hey FPGA boy... when are you gonna sends some VHDL/Verilog our way ? Jul 17 19:33:17 <[g2]> :) Jul 17 19:33:25 I guess the RTC module is just another module built internally right? Jul 17 19:33:30 hehe Jul 17 19:34:22 * Tiersten starts to whistle nonchalantly Jul 17 19:34:31 You'll have to talk to ka6sox when he gets back :) Jul 17 19:42:03 Tiersten, here's the original AVRUSB: http://www.cesko.host.sk/ Jul 17 19:43:35 Thanks Jul 17 20:26:39 night **** ENDING LOGGING AT Sun Jul 17 23:59:57 2005