Show Posts
Pages: [1]
1  Using Arduino / Microcontrollers / Re: Trouble with optiboot @ 20MHz on: March 22, 2013, 08:57:23 pm
Yay its fixed! Please note though, I could not get the bootloader to flash the chip with a 115200 baud rate:
Code:
BAUD RATE CHECK: Desired: 115200, Real: 113636, UBRRL = 21, Error=1.3%

If i set the baud rate in boards.txt to 113636 it works fine. So I guess that 1.3% error is just enough for it not to work

Thank you for the help.

side note: I originally modified the optiboot makefile in the arduino distribution to set F_CPU to 20MHz and the built hex did not work either, but it may suffer from the same baud problem.
2  Using Arduino / Microcontrollers / Re: Trouble with optiboot @ 20MHz on: March 22, 2013, 07:45:07 pm
Well I compiled it with this command
Code:
make atmega328 AVR_FREQ=20000000
in the optiboot (mercurial clone) directory

Output:
Code:
BAUD RATE CHECK: Desired: 115200, Real: 113636, UBRRL = 21, Error=1.3%
avr-gcc -g -Wall -Os -fno-inline-small-functions -fno-split-wide-types -mshort-calls -mmcu=atmega328p -DF_CPU=20000000  -DBAUD_RATE=115200 -DLED_START_FLASHES=3       -c -o optiboot.o optiboot.c
avr-gcc -g -Wall -Os -fno-inline-small-functions -fno-split-wide-types -mshort-calls -mmcu=atmega328p -DF_CPU=20000000  -DBAUD_RATE=115200 -DLED_START_FLASHES=3     -Wl,--section-start=.text=0x7e00 -Wl,--section-start=.version=0x7ffe -Wl,--relax -Wl,--gc-sections -nostartfiles -nostdlib -o optiboot_atmega328.elf optiboot.o
avr-size optiboot_atmega328.elf
   text    data     bss     dec     hex filename
    482       0       0     482     1e2 optiboot_atmega328.elf
avr-objcopy -j .text -j .data -j .version --set-section-flags .version=alloc,load -O ihex optiboot_atmega328.elf optiboot_atmega328.hex
avr-objdump -h -S optiboot_atmega328.elf > optiboot_atmega328.lst
rm optiboot.o optiboot_atmega328.elf

Then burn it with:
Code:
make atmega328_isp

The bootloader flashes the 'L' led on reset so the burn worked but upload always fails.
also, boards.txt:
Code:
##############################################################

atmega328_20.name=atmega328p @ 20MHz
atmega328_20.upload.protocol=arduino
atmega328_20.upload.maximum_size=32256
atmega328_20.upload.speed=115200
atmega328_20.bootloader.low_fuses=0xff
atmega328_20.bootloader.high_fuses=0xde
atmega328_20.bootloader.extended_fuses=0x05
atmega328_20.bootloader.path=optiboot
atmega328_20.bootloader.file=optiboot_atmega328_20MHz.hex
atmega328_20.bootloader.unlock_bits=0x3F
atmega328_20.bootloader.lock_bits=0x0F
atmega328_20.build.mcu=atmega328p
atmega328_20.build.f_cpu=20000000L
atmega328_20.build.core=arduino
atmega328_20.build.variant=standard

##############################################################
3  Using Arduino / Microcontrollers / Re: Trouble with optiboot @ 20MHz on: March 22, 2013, 04:35:31 pm
Hey I just tested uploading blink to the protoboarded avr (20MHz one) using the upload with programmer feature and it works fine. Then I tried the ascii table example and it also is able to send the table properly from the protoboard through the arduino to the computer with serial comms. So this seems to confirm for me that optiboot is what's problematic here.

Edit:
just modified the asciitable sketch to use 115200 baud and it still works with no errors in the output...
4  Using Arduino / Microcontrollers / Re: Trouble with optiboot @ 20MHz on: March 20, 2013, 11:24:43 pm
Response is different it seems each time I try an upload. Here is one output from AVRDude:

Code:
         Programmer Type : Arduino
         Description     : Arduino
avrdude: Send: A [41] . [80]   [20]
avrdude: Recv: . [14]
avrdude: Recv:   [20]
avrdude: Recv: . [fc]

avrdude: stk500_getparm(): (a) protocol error, expect=0x14, resp=0xfc
avrdude: Send: A [41] . [81]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [05]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [82]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [fc]

avrdude: stk500_getparm(): (a) protocol error, expect=0x14, resp=0xfc
avrdude: Send: A [41] . [98]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [03]
avrdude: Recv: . [10]
         Hardware Version: 1992330453
         Firmware Version: 5.-907346418
avrdude: Send: A [41] . [84]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [03]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [85]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [03]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [86]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [03]
avrdude: Recv: . [fc]

avrdude: stk500_getparm(): (a) protocol error, expect=0x14, resp=0xfc
avrdude: Send: A [41] . [87]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [03]
avrdude: Recv: . [fc]

avrdude: stk500_getparm(): (a) protocol error, expect=0x14, resp=0xfc
avrdude: Send: A [41] . [89]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [03]
avrdude: Recv: . [10]
         Vtarget         : 0.3 V
         Varef           : 0.3 V
         Oscillator      : 1.372 Hz
         SCK period      : 3.3 us

avrdude: Send: A [41] . [81]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [05]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [82]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
avrdude: Send: B [42] . [86] . [00] . [00] . [01] . [01] . [01] . [01] . [03] . [ff] . [ff] . [ff] . [ff] . [00] . [80] . [04] . [00] . [00] . [00] . [80] . [00]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
avrdude: Send: E [45] . [05] . [04] . [d7] . [c2] . [00]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
avrdude: Send: P [50]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
avrdude: AVR device initialized and ready to accept instructions

Reading | avrdude: Send: u [75]   [20]
avrdude: Recv: . [14] . [1e] e [65] . [08] . [fc]

avrdude: arduino_read_sig_bytes(): (a) protocol error, expect=0x10, resp=0xfc
avrdude: error reading signature data for part "ATMEGA328P", rc=-3
avrdude: error reading signature data, rc=-1
avrdude: Send: Q [51]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]

avrdude done.  Thank you.
5  Using Arduino / Microcontrollers / Re: Trouble with optiboot @ 20MHz on: March 20, 2013, 04:53:51 pm
I tried setting the baud to 144000 and it did not work so I also tried 20/16 * 113636 = 142045
6  Using Arduino / Microcontrollers / Re: Trouble with optiboot @ 20MHz on: March 20, 2013, 03:18:23 pm
If I compile the new optiboot using the methods suggested it still does not work. The IDE gets no response from the bootloader. If I set the baud to around 144000 then the bootloader responds but the upload doesn't work at all.
7  Using Arduino / Microcontrollers / Trouble with optiboot @ 20MHz on: March 19, 2013, 08:24:46 pm
So I'm trying to use optiboot with a little project I'm doing. I currently have a atmega328p on a protoboard all hooked up with a 20MHz crystal and appropriate wires which I can use to hook it up to an Arduino board for programming. I have compiled optiboot for 20MHz using the source/toolchain/makefile provided with the Ardiono IDE. Using ArduinoISP I can flash this to my AVR on the protoboard just fine. The problem is though, I can not upload any programs to it through the serial port for some reason. I know, however, that the chip is running because when I press reset on the Arduino (avr taken out, hooked up to protoboard with wires) the pin 13 LED flashes just like it should on the bootloader reset. The weird thing is, if I flash the uno bootloader onto the protoboard and swap the crystal for a 16MHz one I am able to flash programs to the protoboard.

So I'm thinking that the problem is either optiboot when compiled for 20MHz, or its my 20MHz crystal. I don't know how it could be the crystal, though, if I can burn the bootloader using it.
8  Using Arduino / Audio / Re: MOD Player (not Arduino based) on: April 02, 2012, 02:08:42 pm
Here's a vid for y'all:
https://www.youtube.com/watch?v=8jA8dkzGCV4

not quite sure how to embed the video here
9  Using Arduino / Audio / Re: MOD Player (not Arduino based) on: January 17, 2012, 09:59:00 pm
I understand that guy has a better player there, however, the significance of my player is that it will run on stock Arduino hardware. And >= atmega328 @ 16MHz arduino should be able to run the code, with possible modifications to the registers if used on another chip.
10  Using Arduino / Audio / Re: MOD Player (not Arduino based) on: January 16, 2012, 10:18:12 pm
Hey this is my first post here and this may sound like high claims, but I have created a mod player ON the Arduino. I don't use the Arduino ide for it, i have made it in AVR Studio. However, it is running on the Arduino's atmega328. I will post my (glitchy, incomplete) code here and a video later. The player does not support every effect because I am lazy and the ones it does support are glitchy at places; however it still does sound pretty good. It does dual channel (stereo) sound output via high speed PWM timers on the chip (pin 10 is right, pin 3 is left channel). Pins 4-7 you can hook up LEDs which light when the player channels 1-4 are active. The player only supports 4 channel mod files, and the mod must fit in the program flash along with the player code. This means that really mods < 20kb can be played. Many chiptunes will fit. I have included the module seen in the video above just as a test. Note: if you intend to compile the code, the utilities included must be used to change the module that is played. avrmodconvert I have made myself to convert the mod file into a format created by me that is easier on the AVR end to read and is also smaller than the original file. The included hex file can be burnt to your Arduino through avrdude to test.

If you like this, have fun.
Pages: [1]