need help in LUFA

74 views
Skip to first unread message

akshay daga

unread,
Feb 28, 2011, 10:00:19 AM2/28/11
to LUFA Library Support List
i have got ATMEGA16U4.. and downloaded the LUFA, i have modified its
make file. i changed the MCU(atmega16u4) part of the makefile but as
soon i change the board part(USER) it shows error related to
clock_div_1. i read the LUFA library http://www.fourwalledcubicle.com/files/LUFA/Doc/090605/html/

it says

"If the USER board type is selected and the application makes use of
one or more board-specific hardware drivers inside the LUFA library,
then the appropriate stub drives files should be copied from the /
BoardStubs/ directory into a /Board/ folder inside the application
directory, and the stub driver completed with the appropriate code to
drive the custom board's hardware."

what does this mean.. can you help me out...

with regards
akshay daga

Mark

unread,
Feb 28, 2011, 1:58:36 PM2/28/11
to lufa-s...@googlegroups.com
Can you post the edited top part of your makefile please?

Opendous

unread,
Feb 28, 2011, 5:01:15 PM2/28/11
to LUFA Library Support List
Older versions of GCC-AVR on Linux are missing some defines. Include
the following in your code:
http://code.google.com/p/micropendous/source/browse/trunk/Micropendous/libs/LUFA/LUFA/MissingDefines.h

As for your other question, create a Board directory in the Board
directory (LUFA/LUFA/Drivers/Board/Board/) and copy over the contents
of LUFA/LUFA/DriverStubs/. Edit these copies for your custom board.

akshay daga

unread,
Mar 1, 2011, 3:11:15 AM3/1/11
to LUFA Library Support List
MCU = atmega16u4

BOARD = USER

F_CPU = 8000000

F_CLOCK = $(F_CPU)

akshay daga

unread,
Mar 1, 2011, 3:15:24 AM3/1/11
to lufa-s...@googlegroups.com
sir i did as you said
but still the error counting the same here i am sending you the
attachment as the snapshot of the errors i am getting... i am using
windowXP and gcc as avrstudio 4.16
> --
> You received this message because you are subscribed to the Google Groups
> "LUFA Library Support List" group.
> To post to this group, send email to lufa-s...@googlegroups.com.
> To unsubscribe from this group, send email to
> lufa-support...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/lufa-support?hl=en.
>
>
error.JPG

akshay daga

unread,
Mar 1, 2011, 5:02:11 AM3/1/11
to lufa-s...@googlegroups.com
i found that clock_div_1 in LEDNotifier.c file (as i am doing the LEDNotifier project as a starting).
i put that line i comment as

//clock_prescale_set(clock_div_1);

and then compiled my project the file got compiled successfully and a hex file has been created. i put that hex file in my IC atmega16u4 and connected a usb connector as shown in datasheet. when i plug that usb connector to my PC, the PC doesn,t show any thing no pop window or no not recognized or malfunction type error..

please do give me a simple hex file for my IC so that i can check out that atlest my PCB connections are proper?

Opendous

unread,
Mar 1, 2011, 9:52:59 AM3/1/11
to LUFA Library Support List
>i put that hex file in my IC atmega16u4

Using the DFU bootloader or ISP? If you used the DFU bootloader
then it must mean that your board's USB works.

>still the error counting the same

Replace //clock_prescale_set(clock_div_1); with:

clock_prescale_set(0);

On Mar 1, 10:02 am, akshay daga <dagaks...@gmail.com> wrote:
> i found that clock_div_1 in LEDNotifier.c file (as i am doing
> the LEDNotifier project as a starting).
> i put that line i comment as
>
> //clock_prescale_set(clock_div_1);
>
> and then compiled my project the file got compiled successfully and a hex
> file has been created. i put that hex file in my IC atmega16u4 and connected
> a usb connector as shown in datasheet. when i plug that usb connector to my
> PC, the PC doesn,t show any thing no pop window or no not recognized or
> malfunction type error..
>
> please do give me a simple hex file for my IC so that i can check out that
> atlest my PCB connections are proper?
>
> On Tue, Mar 1, 2011 at 1:45 PM, akshay daga <dagaks...@gmail.com> wrote:
> > sir i did as you said
> > but still the error counting the same here i am sending you the
> > attachment as the snapshot of the errors i am getting... i am using
> > windowXP and gcc as avrstudio 4.16
> > On 3/1/11, Opendous <opendous.supp...@gmail.com> wrote:
> > > Older versions of GCC-AVR on Linux are missing some defines.  Include
> > > the following in your code:
>
> >http://code.google.com/p/micropendous/source/browse/trunk/Micropendou...

Opendous Support

unread,
Mar 1, 2011, 10:00:27 AM3/1/11
to LUFA Library Support List
Try these VirtualSerial loopbacks. Unfortunately my version of
gcc-avr does not support the ATmega16U4.

The associated source:
http://micropendous.googlecode.com/files/VirtualSerial_Throughput_Maximization.zip

Load the firmware onto your board, plug it in, then connect via a
Serial Terminal. All characters you send should be sent back. The
following may be useful:
http://code.google.com/p/micropendous/wiki/SerialPortUsageWindows

VirtualSerial_ATmega32U4_8MHz.hex
VirtualSerial_AT90USB162_8MHz.hex

akshay daga

unread,
Mar 2, 2011, 5:28:44 AM3/2/11
to lufa-s...@googlegroups.com
thank you all,
i solved that clock_div_1 error just by downloading the new winavr latest version..

i ma using AVRISPmkii to dump the program in my controller...
i had dump the hex file given above VirtualSerial_ATmega32U4_8MHz.hex and also tried with the hex file i created by reding the LUFA library.. but still my controller doesn't show nay response when i plug my USB device(ATmega16U4) in PC... first i thought the VirtualSerial hex file is for 32U4 so that might be responsible for that but later i created a hex file using LUFA library on 16U4 which is also not responding... please check the Circuit (attached).. is this ckt correct or am i doing some mistake in connecting the ckt....

thank you for give you valuable time
with regards
akshay
trying desing.JPG

Peter Kwan

unread,
Mar 2, 2011, 6:37:01 AM3/2/11
to lufa-s...@googlegroups.com
The first thing I'd say is pull the reset pin high! You appear to have
nothing connected to it. Stick a scope on the crystal and see if it
oscillates. If not then you should also look at the fuses.

While you are at it pull up the HWB too. Also I'd expect to see
protection diodes on D+ and D- but you will probably get away without
them, at least for a while.

Peter

Vladivolt

unread,
Mar 2, 2011, 7:20:24 AM3/2/11
to LUFA Library Support List
akshay,
I can recommend to re-read description of UVcc pin in datasheet and
browse
Figure 21-3. Typical Bus powered application with 5V I/O.
USB buffers are not powered in you circuit.

On 2 мар, 13:28, akshay daga <dagaks...@gmail.com> wrote:
> thank you all,
> i solved that *clock_div_1* error just by downloading the new winavr latest
> version..
>
> i ma using AVRISPmkii to dump the program in my controller...
> i had dump the hex file given above VirtualSerial_ATmega32U4_8MHz.hex and
> also tried with the hex file i created by reding the LUFA library.. but
> still my controller doesn't show nay response when i plug my USB
> device(ATmega16U4) in PC... first i thought the VirtualSerial hex file is
> for 32U4 so that might be responsible for that but later i created a hex
> file using LUFA library on 16U4 which is also not responding... *please
> check the Circuit (attached)..* is this ckt correct or am i doing some
> mistake in connecting the ckt....
>
> thank you for give you valuable time
> with regards
> akshay
>
>  trying desing.JPG
> 34KПросмотретьЗагрузить

akshay daga

unread,
Mar 2, 2011, 8:51:37 AM3/2/11
to lufa-s...@googlegroups.com
thank you all for you great suggestions
i modified my CKT as you all said... i din't put protection diode since it was written in data sheet (and one more point i didn't have them right now).... now the ckt looks some thing like i had shown in the attach file... can you directly send me one ckt PLZ...
to dump program into IC i am using AVRISPmkii
 


2011/3/2 Vladivolt <vlad...@yandex.com>
trying desing2.JPG

Cameron Tacklind

unread,
Mar 2, 2011, 3:02:26 PM3/2/11
to lufa-s...@googlegroups.com
I know it's common practice to include a pull-up on the RESET line, but according the the datasheets (not only the USB ones iirc) (under Electrical characteristics, search for "RRST"), they include an internal pull-up in the 30-60kohm range.

Anyone know what happens in the AVRs that share the reset line with an IO line? I assume it just forces on the port's internal pull-up when RESET functionality is needed.

 - Cameron


--

Opendous Support

unread,
Mar 2, 2011, 8:01:56 PM3/2/11
to lufa-s...@googlegroups.com
This is a really useful paper on USB Design Guidelines. Look at Pg.9
and Pg.12. Although it is unlikely you are dealing with signal
integrity issues it is always good to follow best practices. Post a
picture of your setup.

Original source:
http://www.ti.com/sc/docs/apps/msp/intrface/usb/emitest.pdf

emitest.pdf

akshay daga

unread,
Mar 3, 2011, 7:33:06 AM3/3/11
to lufa-s...@googlegroups.com
hello all..
i had downloaded the sch based on atmega32u4(attached) modified a bit for atmega16U4(attached)...
i went through the site
downloaded the the micropendous zip file...
i modified the bootloader makefile section as

MCU = atmega16u4
BOOT_START = 0x3000
F_CPU = 16000000
BOARD = USER
 the file got compile successfully...
i set the fuse bit of my device as
extended=0xF3 highfuse=0x98  lowfuse=0xDE
and when i pluged my USB to the the PC it shows Not recognized error(attached)..

am i still wrong with my ckt??

when i opened the bootloader's make file there where no open for atmega16U4, but still i modifed that. what i did was correct??
attached with bootloader makefile, fusebit snaopshot, my modified ckt, error.
please how can i get out with this...

thank you 
fusebits.JPG
trying desing3.JPG
error.JPG
Micropendous-32U4_Schematic.pdf
makefile

akshay daga

unread,
Mar 3, 2011, 7:34:04 AM3/3/11
to lufa-s...@googlegroups.com
i am just on to read that emitest.pdf

Opendous

unread,
Mar 3, 2011, 7:59:05 AM3/3/11
to LUFA Library Support List
In your schematic the clock is 8MHz but in your makefile it is set to
16MHz. Which is correct?

You do not need the diodes and 3.6V to UCAP. That is only on the
Micropendous board to provide the option of 3.3V or 5V operation. If
you are running at 5V then there should not be any connection to UCAP
other than the 1uF capacitor.

Your makefile and circuit appear correct. Check your wiring is
correctly connected. Try shortening as many wires as possible. The
"USB Not Recognized" error means that at least there is a voltage on
the USB lines. Could your USB signals be reversed or shorted?

Also, try shutting down your host computer completely, then unplug it
for a minute, then restart. If you accidentally shorted your USB
Host's VBUS and GND several times then the host hardware may not have
reset its USB power switches and/or its fuses need to rest.

It would really help to have a picture of your actual hardware.

On Mar 3, 12:34 pm, akshay daga <dagaks...@gmail.com> wrote:
> i am just on to read that emitest.pdf
>
> On Thu, Mar 3, 2011 at 6:03 PM, akshay daga <dagaks...@gmail.com> wrote:
> > hello all..
> > i had downloaded the sch based on atmega32u4(attached) modified a bit for
> > atmega16U4(attached)...
> > i went through the site
> >http://code.google.com/p/micropendous/
> > downloaded the the micropendous zip file...
> > i modified the bootloader makefile section as
>
> > MCU = atmega16u4
> > BOOT_START = 0x3000
> > F_CPU = 16000000
> > BOARD = USER
> >  the file got compile successfully...
> > i set the fuse bit of my device as
> > extended=0xF3 highfuse=0x98  lowfuse=0xDE
> > and when i pluged my USB to the the PC it shows Not recognized
> > error(attached)..
> > *
> > *
> > *am i still wrong with my ckt??*
>
> > when i opened the bootloader's make file there where no open for
> > atmega16U4, but still i modifed that. what i did was correct??
> > attached with bootloader makefile, fusebit snaopshot, my modified ckt,
> > error.
> > please how can i get out with this...
>
> > thank you
>
> > <http://code.google.com/p/micropendous/>
>
> > On Thu, Mar 3, 2011 at 6:31 AM, Opendous Support <
> > opendous.supp...@gmail.com> wrote:
>
> >> This is a really useful paper on USB Design Guidelines.  Look at Pg.9
> >> and Pg.12.  Although it is unlikely you are dealing with signal
> >> integrity issues it is always good to follow best practices.  Post a
> >> picture of your setup.
>
> >> Original source:
> >>http://www.ti.com/sc/docs/apps/msp/intrface/usb/emitest.pdf
>
> >> On Wed, Mar 2, 2011 at 8:02 PM, Cameron Tacklind <came...@tacklind.com>
> >> wrote:
> >> > I know it's common practice to include a pull-up on the RESET line, but
> >> > according the the datasheets (not only the USB ones iirc) (under
> >> Electrical
> >> > characteristics, search for "RRST"), they include an internal pull-up in
> >> the
> >> > 30-60kohm range.
>
> >> > Anyone know what happens in the AVRs that share the reset line with an
> >> IO
> >> > line? I assume it just forces on the port's internal pull-up when RESET
> >> > functionality is needed.
>
> >> >  - Cameron
>
> >> > On Wed, Mar 2, 2011 at 3:37 AM, Peter Kwan <peterk.v...@gmail.com>

akshay daga

unread,
Mar 3, 2011, 8:27:33 AM3/3/11
to LUFA Library Support List
sorry for attachment of that 16MHz file i just tried it on second time
and by mistake i send that one... k i will try it and let you know
thanks alot for you co-operation...

akshay daga

unread,
Mar 3, 2011, 10:18:47 AM3/3/11
to LUFA Library Support List
Working working Working hurryyyyyyyy!!!!!!....
thanks alot for all your help....

but still i am facing one problem...
USBtoSerial code is working on my device but when i dump boot loader into that it shows not recognized error..
y so?? 

Opendous

unread,
Mar 4, 2011, 1:13:53 AM3/4/11
to LUFA Library Support List
Do you program with ISP? ISP programming will overwrite the
bootloader each time.

Program a bootloader into your USB AVR, then use the bootloader to
load new firmware.

If your bootloader does not want to start up, check your makefile
settings and recompile it.

On Mar 3, 3:18 pm, akshay daga <dagaks...@gmail.com> wrote:
> Working working Working hurryyyyyyyy!!!!!!....
> thanks alot for all your help....
>
> but still i am facing one problem...
> USBtoSerial code is working on my device but when i dump boot loader into
> that it shows not recognized error..
> y so??
>
Reply all
Reply to author
Forward
0 new messages