1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-11-29 10:24:12 +01:00

Bugfix for garbage data coming from serial port after reset. (Arduino Due)

Fixed #1267

Merge branch 'fix-usbserial-firmware-due' into ide-1.5.x
This commit is contained in:
Cristian Maglie 2013-02-26 17:35:49 +01:00
commit a58bea74b8
4 changed files with 284 additions and 12 deletions

View File

@ -11,6 +11,9 @@ ARDUINO 1.5.3 BETA
[libraries]
* sam: Added CAN library (still in early stage of development) (Palliser)
[firmwares]
* Arduino Due: fixed USB2Serial garbage at startup (https://github.com/arduino/Arduino/pull/1267)
ARDUINO 1.5.2 BETA - 2013.02.06
[ide]

View File

@ -0,0 +1,272 @@
:10000000A7C00000C0C00000BEC00000BCC000000F
:10001000BAC00000B8C00000B6C00000B4C0000004
:10002000B2C00000B0C00000AEC00000B8C4000004
:100030007CC40000A8C00000A6C00000A4C000004E
:10004000A2C00000A0C000009EC000009CC0000034
:100050009AC0000098C0000096C0000021C10000B6
:1000600092C0000090C000008EC000008CC0000054
:100070008AC0000088C0000086C0000084C0000064
:1000800082C0000080C000007EC000007CC0000074
:100090007AC0000078C000001201100102000008C0
:1000A00041233D0001000102DC0109023E00020182
:1000B00000C0320904000001020201000524000111
:1000C0001004240206052406000107058203080027
:1000D000FF09040100020A000000070504024000B5
:1000E00001070583024000010403090432034100B3
:1000F00072006400750069006E006F002000280027
:100100007700770077002E006100720064007500B0
:1001100069006E006F002E0063006300290000007C
:100120002E03410072006400750069006E006F00CC
:1001300020004400750065002000500072006F0030
:1001400067002E00200050006F0072007400000055
:1001500011241FBECFEFD2E0DEBFCDBF11E0A0E083
:10016000B1E0E2ECF0E102C005900D92A831B107D8
:10017000D9F712E0A8E1B1E001C01D92A833B107A0
:10018000E1F722D19CC73CCF9C01DC01AE57BF4FA9
:10019000ED91FC91119741911196FC93EE9380584B
:1001A0009F4FE817F90711F42D933C939FB7F894EC
:1001B000F901EC57FF4F8081815080839FBF842FCE
:1001C0000895882311F03F9A01C03F9847980895F9
:1001D000882311F046980895469A0895DF92EF9289
:1001E000FF920F931F93FC018489813019F08230B4
:1001F00019F404C010E303C010E001C010E28389C9
:10020000823009F418608589873031F0883031F008
:10021000863029F4126003C0146001C01660109289
:10022000C9001092C8001092CA000785F088E188C2
:10023000D288202F3F2D4E2D5D2D10921E01203B88
:1002400084E0380780E0480780E0580719F481E02F
:1002500080931E01CA01B90122E030E040E050E085
:1002600013D720583B47414E5F4FCA01B901202F99
:100270003F2D4E2D5D2DE6D6215030403093CD00E0
:100280002093CC001093CA0082E08093C80088E9D4
:100290008093C9001F910F91FF90EF90DF90089518
:1002A0001F920F920FB60F9211242F938F939F934B
:1002B000EF93FF939091CE008EB38430F1F4E091F0
:1002C000A201F091A3019083E091A201F091A3011A
:1002D000CF0101969093A3018093A201825A91408D
:1002E00021F482E291E0928381839FB7F894809118
:1002F000A6018F5F8093A6019FBFFF91EF919F9111
:100300008F912F910F900FBE0F901F901895FC01A9
:1003100040911A0140931B0180911C0180931D01A3
:100320008585282F30E02170307020931A01858553
:1003300090E096958795817080931C0180911E01B5
:10034000882339F088E790E0909319018093180191
:100350000895442341F4222331F082E390E0909306
:10036000190180931801089580E091E001C680E0B2
:1003700091E0B4C51F9384B7877F84BF18E10FB69F
:10038000F89410936000109260000FBE80E019DFB7
:10039000469A3E9A87E690E09093CD008093CC00F9
:1003A00086E08093CA001092C8001093C900539A47
:1003B0005A9A8AB180638AB98BB180638BB9AAD209
:1003C00084E085BD1F9108950F931F93CF93DF9312
:1003D000D1DF2FB7F89487EA91E0909328028093B9
:1003E000270290932A02809329022FBF2FB7F894F7
:1003F00082E291E09093A3018093A2019093A501E2
:100400008093A4012FBF7894C7EAD1E003E08FB7AF
:10041000F89490912B028FBF903809F180E091E021
:10042000D3D497FD1CC0E0912702F091280280836D
:10043000E0912702F0912802CF01019690932802C3
:10044000809327028752924011F4D283C1839FB7D1
:10045000F89480912B028F5F80932B029FBF8FB700
:10046000F8941091A6018FBFA89903C0113608F423
:1004700056C0A89A8091A601882361F05D980093E8
:100480001F0108C082E291E07FDE682F80E091E0EA
:1004900001D511501123B1F780911F01882351F02C
:1004A00080911F01815080931F0180911F0188233B
:1004B00009F45D9A80912001882351F080912001F8
:1004C00081508093200180912001882309F45C9A57
:1004D000809118019091190118161906E4F4CC972F
:1004E000CD9710F481E001C080E072DE80911801A8
:1004F000909119010197C29710F481E001C080E04A
:1005000060DE809118019091190101979093190173
:100510008093180104C080E05BDE80E052DE8FB77C
:10052000F89490912B028FBF992369F087EA91E0AC
:100530002BDE982F8091C80085FFFCCF9093CE00D2
:100540005C980093200180E091E095D42AD45FCF9D
:10055000DA01923049F0933061F09130F9F4E8E932
:10056000F0E022E130E01EC0EAEAF0E02EE330E005
:1005700019C0813049F0813018F0823079F408C018
:10058000E8EEF0E0849107C0ECEEF0E0849103C067
:10059000E0E2F1E08491282F30E004C0E0E0F0E0F8
:1005A00020E030E0ED93FC93C901089528E030E0AD
:1005B00040E003C04F5F220F331F28173907D0F3E5
:1005C000842F8295807F08958093E9008091EB00CD
:1005D00081608093EB001092ED006093EC004093FB
:1005E000ED008091EE00881F8827881F08951092E3
:1005F000F40090E09093E9001092F0001092E8006F
:100600001092ED008091EB008E7F8093EB009F5F56
:10061000953081F708958091300288238CF403C0CF
:100620008EB38823B1F08091E80082FFF9CF8091EA
:10063000E8008B778093E80008958EB3882349F013
:100640008091E80080FFF9CF8091E8008E77809359
:10065000E800089594E68091EC0080FF05C0809149
:10066000E80080FF05C023C08091E80082FD1FC024
:100670008EB3882311F482E008958EB3853011F48F
:1006800083E008958091EB0085FF02C081E008952A
:100690008091E10082FFDFCF8091E1008B7F80932A
:1006A000E100992311F484E008959150D4CF80E0C3
:1006B00008959C0140913602509137024617570722
:1006C00018F4F90120E038C06115710511F0AB0193
:1006D000F8CF8091E8008E778093E80040E050E00A
:1006E000F0CF8091E80083FF02C081E008958091FF
:1006F000E80082FD2DC08EB3882381F18EB3853052
:1007000079F18091E80080FF17C09091F20006C057
:1007100081918093F100415050409F5F41155105F8
:1007200011F09830A8F320E0983009F421E080918E
:10073000E8008E778093E8004115510591F6222359
:1007400081F606C08EB3882349F08EB3853041F020
:100750008091E80082FFF6CF80E0089582E008955E
:1007600083E008959C01409136025091370246176C
:10077000570710F490E03BC06115710511F0AB0113
:10078000F9CF8091E8008E778093E80040E050E058
:10079000F1CF8091E80083FF02C081E0089580914D
:1007A000E80082FD30C08EB3882399F18EB3853086
:1007B00091F18091E80080FF1AC08091F20009C099
:1007C000F9012F5F3F4FE491E093F1004150504019
:1007D0008F5F4115510511F0883090F390E088301B
:1007E00009F491E08091E8008E778093E80041154C
:1007F000510579F6992369F606C08EB3882349F02E
:100800008EB3853041F08091E80082FFF6CF80E022
:10081000089582E0089583E008959C0161157105B3
:1008200029F48091E8008B778093E800F90120C0DB
:100830008091E80083FF02C081E008958EB3882391
:1008400039F18EB3853031F18091E80082FFF0CF2D
:1008500006C08091F10081936150704021F0809139
:10086000F2008823B1F78091E8008B778093E8004D
:1008700061157105E9F606C08EB3882349F08EB381
:10088000853041F08091E80080FFF6CF80E0089548
:1008900082E0089583E0089542D044D01EBA1092B9
:1008A0002E0210922D0210922C0284E089BD89B58F
:1008B000826089BD09B400FEFDCF8091D800982FD9
:1008C0009F779093D80080688093D80080916300D0
:1008D0008E7F809363008091D8008F7D8093D800B5
:1008E0008091E0008E7F8093E0008091E1008E7F18
:1008F0008093E1008091E20081608093E20080912A
:10090000E100877F8093E1008091E200886080931E
:10091000E2000895C1DF81E080932F0208951092D4
:10092000E20008951092E10008951F920F920FB611
:100930000F9211241F932F933F934F935F936F93C5
:100940007F938F939F93AF93BF93EF93FF93E9EEC2
:10095000F0E0108117701082E0EFF0E08081877F77
:1009600080837894C3D0F894A9EEB0E01C92E0EFB5
:10097000F0E08081886080831C93FF91EF91BF91AC
:10098000AF919F918F917F916F915F914F913F9127
:100990002F911F910F900FBE0F901F9018951F92CF
:1009A0000F920FB60F9211242F933F934F935F93A3
:1009B0006F937F938F939F93AF93BF93EF93FF9327
:1009C0008091E10080FF1BC08091E20080FF17C092
:1009D0008091E1008E7F8093E1008091E2008E7F24
:1009E0008093E2008091E20080618093E200809138
:1009F000D80080628093D80019BC1EBAD1D18091F2
:100A0000E10084FF29C08091E20084FF25C084E0DA
:100A100089BD89B5826089BD09B400FEFDCF809192
:100A2000D8008F7D8093D8008091E1008F7E8093E5
:100A3000E1008091E2008F7E8093E2008091E200ED
:100A400081608093E20080912E02882311F481E07E
:100A500001C084E08EBBA4D18091E10083FF27C058
:100A60008091E20083FF23C08091E100877F809323
:100A7000E10082E08EBB10922E028091E1008E7F19
:100A80008093E1008091E2008E7F8093E20080916C
:100A9000E20080618093E200AADD80E060E042E055
:100AA00093DD8091F00088608093F00079D180918F
:100AB000E10082FF0AC08091E20082FF06C08091BF
:100AC000E1008B7F8093E1006BD1FF91EF91BF91AB
:100AD000AF919F918F917F916F915F914F913F91D6
:100AE0002F910F900FBE0F901F9018951F93DF93BB
:100AF000CF93CDB7DEB7AC970FB6F894DEBF0FBE7D
:100B0000CDBFE0E3F2E08091F100819322E0E83391
:100B1000F207C9F78091300230913102353009F483
:100B200087C0363040F43130C9F1313070F03330A5
:100B300009F01DC133C0383009F4EFC0393009F471
:100B4000FEC0363009F013C192C0803821F08238DF
:100B500009F00DC108C090912C0280912D028823CC
:100B600099F0926011C08091340287708093E900FF
:100B70008091EB0090E025E0969587952A95E1F726
:100B8000982F91701092E9008091E800877F809300
:100B9000E8009093F1001092F100CAC0882319F088
:100BA000823009F0E4C090E08F719070009721F0DE
:100BB000029709F0DDC00CC080913202813009F04B
:100BC000D7C010922D02333069F580932D022AC0D0
:100BD00080913202882331F520913402277009F484
:100BE000C7C02093E9008091EB0080FFC1C0333083
:100BF00021F48091EB00806213C08091EB00806152
:100C00008093EB0081E090E002C0880F991F2A9545
:100C1000E2F78093EA001092EA008091EB0088608E
:100C20008093EB001092E9008091E800877F83C0F9
:100C3000882309F09CC0109132028091E800877FE0
:100C40008093E800E8DC04C08EB3882309F490C0E8
:100C50008091E80080FFF8CF812F8F7711F492E028
:100C600001C093E09EBB80688093E30081C0805800
:100C7000823008F07CC0809132029091330223E0F0
:100C80008C3D920799F55FB7F894DE0115964EE01A
:100C900020E030E061E2E42FF0E0609357008491BF
:100CA00020FF03C082958F704F5F982F9F70892F10
:100CB000805D8A3308F0895F8C9311961C9211979E
:100CC0002F5F3F4F12962431310529F75FBF8AE22B
:100CD0008B8383E08C838091E800877F8093E8009A
:100CE000CE0103966AE270E0E4DC11C06091340248
:100CF000AE014F5F5F4F2CDCBC010097C9F18091C2
:100D0000E800877F8093E80089819A812BDD8091BC
:100D1000E8008B778093E8002BC0803841F5809104
:100D2000E800877F8093E80080912E028093F10095
:100D30008091E8008E778093E8006DDC19C08823ED
:100D4000B1F490913202923098F48091E800877F5C
:100D50008093E80090932E025EDC80912E0288231F
:100D600011F483E001C084E08EBB01DB01C0FCDA3A
:100D70008091E80083FF0AC08091EB00806280933D
:100D8000EB008091E800877F8093E800AC960FB677
:100D9000F894DEBF0FBECDBFCF91DF911F910895B4
:100DA00008951F938EB3882361F01091E90010928B
:100DB000E9008091E80083FF01C098DE177010936E
:100DC000E9001F9108950895FC018EB3843021F548
:100DD00087859089A189B2890097A105B105E1F0C5
:100DE00085818093E9008091E80082FF15C08091A1
:100DF000F200882319F42FEF3FEF04C08091F10037
:100E0000282F30E08091F200882341F48091E8009F
:100E10008B778093E80002C02FEF3FEFC901089560
:100E2000FC018EB3843011F587859089A189B28940
:100E30000097A105B105D1F081818093E9008091EF
:100E4000F2008823A9F09091E8008091E8008E7765
:100E50008093E80095FD0CC0FDDB982F882349F4B2
:100E60008091E8008E778093E80003C092E001C093
:100E700090E0892F0895FC018EB3843051F487856A
:100E80009089A189B2890097A105B10511F0CF0120
:100E9000C7CF08951F93FC01162F8EB38430D9F469
:100EA00087859089A189B2890097A105B10599F03C
:100EB00081818093E9008091E80085FD08C08091E0
:100EC000E8008E778093E800C5DB882329F410932F
:100ED000F10080E001C082E01F9108950F931F93FD
:100EE000CF93DF93EC010D96FC0189E0DF011D92A9
:100EF0008A95E9F72A813B8109818C81882311F445
:100F000010E001C014E0C90151DB182B1260802FE2
:100F100061E8412F59DB882329F12E813F810D8122
:100F20008885882311F410E001C014E0C9013EDB7C
:100F3000182B1260802F60E8412F46DB882391F048
:100F40002A853B8509858C85882311F410E001C032
:100F500014E0C9012BDB182B1260802F61EC412FAC
:100F600033DB01C080E0DF91CF911F910F91089595
:100F7000CF93DF93EC018091E80083FF60C088810C
:100F800090E020913402309135022817390709F09A
:100F900056C080913102813261F0823220F4803279
:100FA00009F04DC019C0823269F1833209F047C09F
:100FB00038C080913002813A09F041C08091E80048
:100FC000877F8093E800CE010F9667E070E071DBC9
:100FD0008091E8008B7713C080913002813279F5DF
:100FE0008091E800877F8093E800CE010F9667E04C
:100FF00070E013DCCE01F2D88091E8008E77809308
:10100000E8001DC0809130028132C9F48091E8006F
:10101000877F8093E800809132028D87CE0177D957
:101020000DC080913002813251F48091E800877FB9
:101030008093E800CE0160913202C5DEECDADF91E8
:10104000CF910895A1E21A2EAA1BBB1BFD010DC072
:10105000AA1FBB1FEE1FFF1FA217B307E407F50768
:1010600020F0A21BB30BE40BF50B661F771F881F44
:10107000991F1A9469F760957095809590959B01DA
:10108000AC01BD01CF01089597FB092E05260ED0B6
:1010900057FD04D0D7DF0AD0001C38F45095409596
:1010A000309521953F4F4F4F5F4F0895F6F790953C
:1010B0008095709561957F4F8F4F9F4F0895F8945D
:0210C000FFCF60
:1010C200000340000004400000020800000000008D
:0810D200000000000000140002
:00000001FF

View File

@ -161,20 +161,17 @@ int main(void)
{
// SAM3X RESET/ERASE Sequence
// --------------------------
if (ResetTimer == 95) {
// Between 60 and 120: do erase
if (ResetTimer >= 60 && ResetTimer <= 120) {
setErasePin(true);
setResetPin(false);
}
if (ResetTimer == 35) {
} else {
setErasePin(false);
setResetPin(false);
}
if (ResetTimer == 25) {
setErasePin(false);
// Between 1 and 50: do reset
if (ResetTimer >= 1 && ResetTimer <= 50) {
setResetPin(true);
}
if (ResetTimer == 1) {
setErasePin(false);
} else {
setResetPin(false);
}
ResetTimer--;
@ -303,10 +300,10 @@ void EVENT_CDC_Device_ControLineStateChanged(USB_ClassInfo_CDC_Device_t* const C
if (Selected1200BPS) {
/* Start Erase / Reset procedure when receiving the magic "1200" baudrate */
ResetTimer = 95;
ResetTimer = 120;
} else if (!PreviousDTRState && CurrentDTRState) {
/* Reset on rising edge of DTR */
ResetTimer = 30;
ResetTimer = 50;
}
}