Atmega8 with USB??

Go To Last Post
16 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Would it be possible to communicate between one DE2 board and multiple Atmega8s with USB? (possible v-usb since Atmega8 doesn't offer USB) I'm doing my project and want to see if this is possible before I start actual work.. If this is possible what would be the data transferring speed?
Cheers

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

possible v-usb since Atmega8 doesn't offer USB

You kind of answered your own question there. DE2 is Altera FPGA isn't it? Would it not be easier simply to make some UARTs at that end?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'd have used the RS485 instead - the v-usb is a way slow and resource hangry.

Warning: Grumpy Old Chuff. Reading this post may severely damage your mental health.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I want to control many stepper motors (possibly more than 100 stepper motors) with DE2 and use Atmega8 to control each motor. De2 sends control data to each atmega8. This way I can save alot of control pins on DE2. I dont want to make more thn 100 UARTs

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
Quote:

possible v-usb since Atmega8 doesn't offer USB

You kind of answered your own question there. DE2 is Altera FPGA isn't it? Would it not be easier simply to make some UARTs at that end?

I want to control many stepper motors (possibly more than 100 stepper motors) with DE2 and use Atmega8 to control each motor. De2 sends control data to each atmega8. This way I can save alot of control pins on DE2. I dont want to make more thn 100 UARTs

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Then do what MBedder said and use RS485 - one (possibly a handful?) of UARTs at the host end and many slave devices that respond to an addressing mechanism sent in-band.

The other option might be I2C (which Atmel call TWI).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jdgch2009 wrote:
I want to control many stepper motors (possibly more than 100 stepper motors) with DE2 and use Atmega8 to control each motor. De2 sends control data to each atmega8. This way I can save alot of control pins on DE2. I dont want to make more thn 100 UARTs
In this case you do not need 100 UARTS nor RS485. A single DE2 UART (or I2C) sends address and command/parameter to all Mega8's, and only one Mega which has recognized its address, performs the requested action. Forget about USB.

Warning: Grumpy Old Chuff. Reading this post may severely damage your mental health.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Unless you neeed feedback from the micros driving the stepper motors to confirm that it received the command.

Then you are back to RS485.

JC

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I2C will handle the feedback as well.

Warning: Grumpy Old Chuff. Reading this post may severely damage your mental health.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hmmm--it brings an automotive network to mind. CAN?

Even with a USB-enabled AVR wouldn't the master then need to be a 100-port "hub"?

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Hmmm--it brings an automotive network to mind. CAN?

But then he's going to need 100 CAN tranceivers to add to the mega8's. I assume (I know) he was looking for a soft solution? Even RS485 is going to cost electronics.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Knowing how far apart those motors are might exclude some of the options. And total expected length of wire.
Also if the connections will be star-shape or serial.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I was thinking I2c but only problem was it's max speed is only 400kHz for atmega8. My project partner is developing SPI way and I'm looking for other solutions and I was wondering if USB is a possible solution

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
I was wondering if USB is a possible solution

Not worth it, but technically possible.
For USB there needs to be a Master, such as a PC, and the remote devices which plug into the USB bus, (such as a thumb drive, etc.).

There are some chips with (limited, OTG, USB Master capability). One could also use a stand-alone chip to be the USB Master, (which then needs non-USB serial comm's to the main micro).

Also, if you use USB you must use appropriate cabling. This can also significantly increase the cost. There are also limits on the length of a USB cable which could be exceeded given your 100 remote devices.

Bottom line, there ARE many good options for connecting the micro to a large collection of remote devices, but in this case USB is at the bottom of the list.

JC

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I agree with DocJC.

Also, if you use V-USB, you still need a few extra components, and the software implementation is slow. So it won't much faster than the 400kHz of the I2C.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
I was thinking I2c but only problem was it's max speed is only 400kHz for atmega8.

Note that V-USB is low-speed USB which will probably be slower than 400kHz once you include protocol overhead.

You might look at DMX512 (http://en.wikipedia.org/wiki/DMX512 ), which is normally used to tie up to 512 lights (ie for theater) to a controller, using convenient wiring. That gets you back to rs485 for the physical layer (unless you ignore the physical layer as much a V-USB ignores the physical layer of USB...) the advantage would be that there is probably significant amounts of exitsing DMX512 code for AVR...