Rapa Nui
Offline
God Member
Karma: 16
Posts: 888
Pukao hats cleaning services
|
 |
« Reply #120 on: February 02, 2013, 06:17:00 am » |
FYI - a simulation - signal from FTDI to the Rx pin, and Rx coupled via a parasitic capacitance to the XTAL1 pin of the 1284p's oscillator. For 3 parasitic capacitances - 1pF, 5pF, 10pF. You may see the effect on the frequency when the rising edge of the Rx signal comes in. May behave differently - depends on the gate (here 4011 gate model used), xtal (??), etc. parameters used.
Disclaimer: this is only a simple simulation with parts with different parameters as the 1284p probably includes. For demonstration purposes only. No warranties of any kind.
|
|
|
|
« Last Edit: February 02, 2013, 07:25:20 am by pito »
|
Logged
|
|
|
|
|
Rapa Nui
Offline
God Member
Karma: 16
Posts: 888
Pukao hats cleaning services
|
 |
« Reply #121 on: February 02, 2013, 06:55:46 am » |
And the same for 5pF parasitic capacitance between the pins and 200ohm (no resistor), 10k, 200k serial resistor. It seems the 200k does not create a glitch in the oscillation (in this simulation).
Disclaimer: simple simulation only, with different parts as included within 1284p. For demo purposes only. No warranties of any kind.
PS: The very bottom picture is probably the most realistic simulation out of all above- with 4049 inverter simulating the 1284p oscillator with more power (full swing), and 10pF capacitance between the RX and XTAL1 pins. The oscillator period changed from 127.1ns to 135.4ns after the Rx' rising edge (thus the frequency)..
|
|
|
|
« Last Edit: February 03, 2013, 06:55:20 pm by pito »
|
Logged
|
|
|
|
|
the land of sun+snow
Offline
Edison Member
Karma: 81
Posts: 2129
|
 |
« Reply #122 on: February 02, 2013, 02:09:13 pm » |
Solved? With Low Fuse= F7 (Full Swing Oscillator 16K CK + 45ms) I cannot reproduce the upload errors anymore (the 10k serial resistor is not needed). It could be the 1284p operated @16MHz and 3V3 needs full swing (more power), otherwise the nearby RX pin may influence (modulate) the crystal oscillator frequency (especially with the DIP package with larger capacitance between the pins) and it comes to errors then.. PS: XTAL1 pin13 (RX is 14) - is the input of the crystal oscillator (high impedance, easy to modulate), would be better to have XTAL2 pin - the oscillator output - there (low impedance, harder to modulate)..
Huh! It's extremely cool that you've been carrying on with this problem while the rest of us have been sleeping! I don't know anything about USBasp or the ATmega fuses, and can barely understand the convoluted description of the latter in the 1284 d/s, but you may have solved the problem. Ref Table 9-1, maniacbug's boards.txt setup uses the low-power oscillator, low fuses = 0xFF, instead of full swing oscillator, low-fuses = 0xF7 and there lies the RX0 sensitivity problem. Plus, possibly the XTAL1 is in the wrong place. Sheesh, can this endless muckup on 7 continents be that simple? !!!
|
|
|
|
|
Logged
|
|
|
|
|
Rapa Nui
Offline
God Member
Karma: 16
Posts: 888
Pukao hats cleaning services
|
 |
« Reply #123 on: February 03, 2013, 01:39:17 pm » |
I am using it just now w/o the resistor on a noisy breadboard with F7 and it works fine, no issues yet..  BTW, the 328p arduinos are lucky not to be affected by the issue as well as the Rx and Tx pins are far away off the XTAL1 pin. Moreover, XTAL1 (the critical sensitive crystal oscillator input) is flipped around against the 1284p and close to GND - GND acts as a shielding (GOOD)! See below.. IMHO the issue severity depends on the design (parasitic capacitance), crystal parameters, 2 crystal capacitors values, and how off is the actual crystal frequency from the recommended ie for 115k2: 8MHz crystal 57k 3.7% error 115k 7.8% error 16MHz crystal 57k 2.1% error 115k 3.7% error Thus even a small additional error introduced ie. by such frequency pulling by Rx signal edges may disturb the Uart communication easily.. That is my current understanding  If Atmel plans a new die revision, I would recommend them to swap the oscillator pins, my invoice will follow 
|
|
|
|
« Last Edit: February 03, 2013, 02:58:05 pm by pito »
|
Logged
|
|
|
|
|
the land of sun+snow
Offline
Edison Member
Karma: 81
Posts: 2129
|
 |
« Reply #124 on: February 03, 2013, 02:36:29 pm » |
Good analysis, I think. Funny how Atmel flipped XTAL1,2 around between the 328 and 1284. Also, 2.1 and 3.7% errors are on the edge of reliability, AFAIAC.
|
|
|
|
|
Logged
|
|
|
|
|
Rapa Nui
Offline
God Member
Karma: 16
Posts: 888
Pukao hats cleaning services
|
 |
« Reply #125 on: February 03, 2013, 02:38:05 pm » |
BTW - hand wired constructions usually have less parasitic capacitances as the PCBs do.. BTW2 - the capacitance between two adjacent rows on a solder-less breadboard is around 3.5pF..
|
|
|
|
« Last Edit: February 03, 2013, 02:48:17 pm by pito »
|
Logged
|
|
|
|
|
UK
Offline
Sr. Member
Karma: 9
Posts: 351
|
 |
« Reply #126 on: February 03, 2013, 05:06:53 pm » |
I've been uploading to my 1284P via ICSP due to this problem, even just a 23k sketch failed every time via the bootloader and serial.
I've just re-burnt the bootloader and tried the same sketch 3 times and it failed.
I added the 10k series resistor on RX0 and tried again and it worked!
Tried it 6 times and it uploaded 100%.
Removed the 10k resistor and it failed.
Replaced the resistor and it worked 3 times in a row again.
I'll now try re-burning the fuses with the 0xF7 low bit and report back.
EDIT: Used Nick's Bootloader Programmer (for the first time) to re-burn the bootloader and set the fuses (I changed Low Fuse from 0xFF to 0xF7 in his sketch) and retried the upload with no resistor. It worked! Now I just need a big sketch to verify it really.
The most profound thanks to you guys for working together to track down and find a solution to this problem. Ye, you can upload via ICSP, but when your board is in a device that means you have to take everything off the SPI bus. On the board I just had made I actually included a 4 pin DIP switch so I could separate everything else form the ICSP header for any code updates that needed to be programmed. I also have a serial header available as well.
Right, now it appears that the 644P family is in the sketch to be identified but there is no entry for a bootloader or fuses setup. Does anyone know how we might go about adding 644P support?
|
|
|
|
« Last Edit: February 03, 2013, 05:32:45 pm by tack »
|
Logged
|
|
|
|
|
Rapa Nui
Offline
God Member
Karma: 16
Posts: 888
Pukao hats cleaning services
|
 |
« Reply #127 on: February 03, 2013, 05:31:30 pm » |
Enclosed 127kB large sketch. Not to be run, just for upload tests. Enjoy!
EDIT: deleted - please use the BLINK sketch below..
|
|
|
|
« Last Edit: February 03, 2013, 06:13:42 pm by pito »
|
Logged
|
|
|
|
|
UK
Offline
Sr. Member
Karma: 9
Posts: 351
|
 |
« Reply #128 on: February 03, 2013, 05:37:38 pm » |
Enclosed 127kB large sketch. Not to be run, just for upload tests. Enjoy!
Thanks for that, but I can't compile and upload as it needs some libraries; NilTROS, NilAnaolg, NilSerial and SDFat SDFat I can get, but I can't find the others at all so I'm guessing they are ones of your own?
|
|
|
|
|
Logged
|
|
|
|
|
Rapa Nui
Offline
God Member
Karma: 16
Posts: 888
Pukao hats cleaning services
|
 |
« Reply #129 on: February 03, 2013, 05:41:07 pm » |
http://arduino.cc/forum/index.php/topic,144715.0.htmlBut you may take ANY sketch you have handy - just copy and paste those LARGE byte PROGMEM atmega2560_v2 [] = { 0x0D, 0x94, 0x89, 0xF1, 0x0D, 0x94, bla-bla stuff from the sketch I posted in it.. You can easily make 512kB sketch from it if you like 
|
|
|
|
« Last Edit: February 03, 2013, 05:42:49 pm by pito »
|
Logged
|
|
|
|
|
Rapa Nui
Offline
God Member
Karma: 16
Posts: 888
Pukao hats cleaning services
|
 |
« Reply #130 on: February 03, 2013, 05:58:51 pm » |
This BLINK compiles 129,948 bytes. You have to have SdFat lib there. Not for running, just for compile and 1284p upload test.. Remove your SDCARD when playing with it.. No warranties of any kind. Use at your own risk..  Binary sketch size: 129,948 bytes (of a 130,048 byte maximum)
|
|
|
|
« Last Edit: February 03, 2013, 06:47:53 pm by pito »
|
Logged
|
|
|
|
|
UK
Offline
Sr. Member
Karma: 9
Posts: 351
|
 |
« Reply #131 on: February 03, 2013, 06:01:57 pm » |
I managed to find the libraries to use your sketch.
O...M...G...It works!! 127k Sketch uploaded several times.
Fantastic work.
|
|
|
|
|
Logged
|
|
|
|
|
Left Coast, CA (USA)
Offline
Brattain Member
Karma: 279
Posts: 15314
Measurement changes behavior
|
 |
« Reply #132 on: February 03, 2013, 06:12:24 pm » |
Right, now it appears that the 644P family is in the sketch to be identified but there is no entry for a bootloader or fuses setup. Does anyone know how we might go about adding 644P support?
I have a optiboot version working on a 644P Bobuino board. I just used my USBtiny to burn the bootload, but the arduinoISP sketch should work also from the IDE once you have the bootloader saved in the correct folder and make the boards.txt entry. :020000000504F5 :10FC0000112484B714BE81FFF2D085E08093810077 :10FC100082E08093C00088E18093C10086E08093F9 :10FC2000C20080E18093C4008EE0CBD0209A86E0B1 :10FC300020E33CEF91E0309385002093840096BB55 :10FC4000B09BFECF189AA8958150A9F7CC24DD244B :10FC500088248394B5E0AB2EA1E19A2EF3E0BF2E69 :10FC6000A4D0813471F4A1D0082FB1D0023811F49E :10FC700085E005C0013811F484E001C083E08DD037 :10FC800089C0823411F484E103C0853419F485E01D :10FC9000A6D080C0853579F488D0E82EFF2485D0A1 :10FCA000082F10E0102F00270E291F29000F111F09 :10FCB0008ED068016FC0863521F484E090D080E05A :10FCC000DECF843609F040C070D06FD0082F6DD0E1 :10FCD00080E0C81680EED80618F4F601B7BEE895A5 :10FCE000C0E0D1E062D089930C17E1F7F0E0CF16C5 :10FCF000F0EEDF0618F0F601B7BEE89568D007B65B :10FD000000FCFDCFA601A0E0B1E02C9130E01196FF :10FD10008C91119790E0982F8827822B932B129625 :10FD2000FA010C0187BEE89511244E5F5F4FF2E0A7 :10FD3000A030BF0751F7F601A7BEE89507B600FC53 :10FD4000FDCF97BEE89526C08437B1F42ED02DD0D4 :10FD5000F82E2BD03CD0F601EF2C8F010F5F1F4FF8 :10FD600084911BD0EA94F801C1F70894C11CD11CFE :10FD7000FA94CF0CD11C0EC0853739F428D08EE10F :10FD80000CD086E90AD08AE07ACF813511F488E078 :10FD900018D01DD080E101D063CF982F8091C00092 :10FDA00085FFFCCF9093C60008958091C00087FF27 :10FDB000FCCF8091C00084FD01C0A8958091C60051 :10FDC0000895E0E6F0E098E1908380830895EDDF08 :10FDD000803219F088E0F5DFFFCF84E1DECF1F939A :10FDE000182FE3DF1150E9F7F2DF1F91089580E04B :08FDF000E8DFEE27FF2709946C :040000030000FC00FD :00000001FF
And here is the boards.txt entry for the 644P ##############################################################
bobuino644.name=Bobuino 644P optiboot bobuino644.upload.protocol=arduino bobuino644.upload.maximum_size=63488 bobuino644.upload.speed=115200 bobuino644.bootloader.low_fuses=0xff bobuino644.bootloader.high_fuses=0xdc bobuino644.bootloader.extended_fuses=0xfd bobuino644.bootloader.path=optiboot bobuino644.bootloader.file=optiboot_atmega644p-4-5.hex bobuino644.bootloader.unlock_bits=0x3F bobuino644.bootloader.lock_bits=0x0F bobuino644.build.mcu=atmega644p bobuino644.build.f_cpu=16000000L #bobuino644.build.core=arduino:arduino bobuino644.build.core=standard bobuino644.build.variant=bobuino
##############################################################
Lefty
|
|
|
|
« Last Edit: February 03, 2013, 06:16:58 pm by retrolefty »
|
Logged
|
|
|
|
|
Rapa Nui
Offline
God Member
Karma: 16
Posts: 888
Pukao hats cleaning services
|
 |
« Reply #133 on: February 03, 2013, 07:09:03 pm » |
..and there lies the RX0 sensitivity problem.
To clarify a little bit - No, it is not the "RX0 sensitivity" problem. That is an urban myth.. RX0 is perfectly fine. It is definitely the XTAL1-pin placement problem (crystal oscillator input) - and most notably a not good decision at Atmel not to follow ie. the 328p as far as the crystal oscillator pins layout is concerned..
|
|
|
|
« Last Edit: February 03, 2013, 07:24:35 pm by pito »
|
Logged
|
|
|
|
|
Left Coast, CA (USA)
Offline
Brattain Member
Karma: 279
Posts: 15314
Measurement changes behavior
|
 |
« Reply #134 on: February 03, 2013, 11:33:49 pm » |
lefty, where did you get this file? --> optiboot_atmega644p-4-5.hex
I think here: http://code.google.com/p/optiboot/downloads/listfrom here: http://code.google.com/p/optiboot/The only bootloader I can't remember a source site from is the optiboot compiled for the mega1280 chip which I found only after several days of searching. But I finely did locate a copy somewhere and now all my mega1280 boards (both of them LOL) are working well with optiboot. Lefty
|
|
|
|
|
Logged
|
|
|
|
|
|