
AVRisp tested on ATMega88A inspired by various implementations around: - AVR_SPI_Programmer_v2 ( BO Qiang ) - mAVRISP (Aaron Berk) - TestAVRISP(Chester Hamilton)
AVRisp implementation for mBED
Revision 1:4b883042df7d, committed 2015-04-28
- Comitter:
- Ellips
- Date:
- Tue Apr 28 11:01:19 2015 +0000
- Parent:
- 0:29abe3c0b902
- Commit message:
- AVRisp , v0.1
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Tue Apr 28 10:53:26 2015 +0000 +++ b/main.cpp Tue Apr 28 11:01:19 2015 +0000 @@ -59,24 +59,7 @@ pc.printf("Erasing Chip: "); avrisp->ChipErase(); - pc.printf(" Done\n"); - - /*pc.printf("Write Fuse Low Byte.\n"); - avrisp.WriteFuseLow(FUSE_LOW); - pc.printf("Fuse Low Byte Readback = %x.\n",avrisp.ReadFuseLow()); - - pc.printf("Write Fuse High Byte.\n"); - avrisp.WriteFuseLow(FUSE_HIGH); - pc.printf("Fuse High Byte Readback = %x.\n",avrisp.ReadFuseHigh()); - - pc.printf("Write Fuse Extended Byte.\n"); - avrisp.WriteFuseLow(FUSE_EXTENDED); - pc.printf("Fuse Extended Byte Readback = %x.\n",avrisp.ReadFuseExtended()); - - pc.printf("Write Lock Byte.\n"); - avrisp.WriteLockByte(LOCK_BYTE); - pc.printf("Lock Byte Readback = %x.\n",avrisp.ReadLockByte()); */ - + pc.printf(" Done\n"); pc.printf("Programing Flash:"); if(avrisp->ProgramFlash(hexFile)) { @@ -94,23 +77,37 @@ pc.printf("Failed.\n"); } + //fuses + /*pc.printf("Write Fuse Low Byte.\n"); + avrisp->WriteFuse(AVRISP::eFTLo, FUSE_LOW); + pc.printf("Fuse Low Byte Readback = %x.\n",avrisp->ReadFuse(AVRISP::eFTLo)); + + pc.printf("Write Fuse High Byte.\n"); + avrisp->WriteFuse(AVRISP::eFTHi, FUSE_HIGH); + pc.printf("Fuse High Byte Readback = %x.\n",avrisp->ReadFuse(AVRISP::eFTHi)); + + pc.printf("Write Fuse Extended Byte.\n"); + avrisp->WriteFuse(AVRISP::eFTEx, FUSE_EXTENDED); + pc.printf("Fuse Extended Byte Readback = %x.\n",avrisp->ReadFuse(AVRISP::eFTEx)); + + pc.printf("Write Lock Byte.\n"); + avrisp->WriteFuse( AVRISP::eFTLock, LOCK_BYTE); + pc.printf("Lock Byte Readback = %x.\n",avrisp->ReadFuse(AVRISP::eFTLock));*/ + avrisp->LeaveProgrammingMode(); while(true) - __WFI(); + __WFI();//do something nice exit: if(ProgMode) avrisp->LeaveProgrammingMode(); - if(avrisp){ + if(avrisp) delete avrisp; - avrisp = NULL; - } if (hexFile) - fclose(hexFile); - + fclose(hexFile); return result; }