avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] USB?


From: Reza Naima
Subject: Re: [avr-gcc-list] USB?
Date: Thu, 6 Nov 2003 03:45:16 -0800
User-agent: Mutt/1.5.4i

Acutally, you can simply attach the IO bus to the data bus (for the
atmega128 it's portA), attach the Read and write lines, and you need to
control lines to determine if the buffers are full.  This is the
resulting code to talk to the IC :


--------------------------------
#define USB_DEV_ADDR 0x1100
#define USB_TXRXPIN PIND
#define USB_RXE 7
#define USB_TXE 6
#define USB_DDR_TXE DDRD
#define USB_DDR_RXE DDRD

volatile uint8_t *usb_dev;

void usb_init(void) {
        usb_dev = (unsigned char *)USB_DEV_ADDR;
        sbi(MCUCR, SRE);
        cbi( USB_DDR_TXE, USB_TXE ); // input
        cbi( USB_DDR_RXE, USB_RXE ); // input
        sbi( PORTD, USB_TXE); //enable pullup
        sbi( PORTD, USB_RXE); //enable pullup
        XMCRB = _BV(XMM2) | _BV(XMM1) | _BV(XMM0);
}

uint8_t usb_getc(void) {
        loop_until_bit_is_clear( USB_TXRXPIN, USB_RXE);
        return *usb_dev;
}

void usb_putc( uint8_t c ) {
        loop_until_bit_is_clear(USB_TXRXPIN, USB_TXE);
        *usb_dev = c;
}

-----------------------------------

On Mon, Nov 03, 2003 at 08:30:49AM +0100, Uccelli Danilo sent me this...
> Hi,
> 
> It is very easy to use an standard I/O port to work with the FTDI parallel
> chip FT245BM.
> 
> On an ATmega64 I have used PORTA for the bi-directional data bus, and an
> other port for 2 bits in output (RD ant WR command) and 2 bits in input (for
> reading the status).
> 
> The software have to change the direction of the data port to read or write
> data, but this is not to heavy because the chip have enough FIFO space.
> 
> Danilo
> 
> -----Original Message-----
> From: Jamie Morken [mailto:address@hidden
> Sent: Monday, November 03, 2003 7:07 AM
> To: address@hidden
> Subject: Re: [avr-gcc-list] USB?
> 
> 
> Hi,
> 
> I have one of these too but haven't hooked it up to the AVR yet, do you have
> an example of the memory mapped interface to the AVR?  Does this only work
> on AVR's with external SRAM?
> 
> cheers,
> Jamie
> 
> ----- Original Message -----
> From: "Reza Naima" <address@hidden>
> To: "Torsten Mohr" <address@hidden>
> Cc: <address@hidden>
> Sent: Sunday, November 02, 2003 8:39 PM
> Subject: Re: [avr-gcc-list] USB?
> 
> 
> > I use and love the FTDI 8 bit<->usb controller ICs.  Works flawlessly
> > with the memory mapped interface, or they have a serial<->usb IC which
> > didn't seem as useful.
> >
> > Reza
> >
> > On Mon, Nov 03, 2003 at 12:38:46AM +0100, Torsten Mohr sent me this...
> > > Hi,
> > >
> > > i saw in the archive that there was a discussion on
> > > USB on the AT43USB355.
> > >
> > > Is this working?
> > >
> > > Are there examples available?
> > >
> > > I'd like to implement a serial-over-USB connection
> > > to that target.  Any other hints?
> > >
> > >
> > > Best regards,
> > > Torsten.
> 
> _______________________________________________
> avr-gcc-list mailing list
> address@hidden
> http://www.avr1.org/mailman/listinfo/avr-gcc-list


reply via email to

[Prev in Thread] Current Thread [Next in Thread]