diff options
author | cpldcpu <cpldcpu@gmail.com> | 2014-03-16 08:13:29 +0100 |
---|---|---|
committer | cpldcpu <cpldcpu@gmail.com> | 2014-03-16 08:13:29 +0100 |
commit | ca5b4534b621a0100cc5aa2ea9babb6f7bafd037 (patch) | |
tree | 0457a37c46dd0a6af4661048a98ec5a9d95828d9 /firmware/osccalASM.S | |
parent | c6fd947a101dfc5f0cf021b4892d00abaa9fa252 (diff) | |
download | micronucleus-ca5b4534b621a0100cc5aa2ea9babb6f7bafd037.tar.gz micronucleus-ca5b4534b621a0100cc5aa2ea9babb6f7bafd037.tar.bz2 micronucleus-ca5b4534b621a0100cc5aa2ea9babb6f7bafd037.zip |
firmware: Attiny841 first working config
Diffstat (limited to 'firmware/osccalASM.S')
-rw-r--r-- | firmware/osccalASM.S | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/firmware/osccalASM.S b/firmware/osccalASM.S index 6b24b50..e8e174e 100644 --- a/firmware/osccalASM.S +++ b/firmware/osccalASM.S @@ -106,7 +106,11 @@ calibrateOscillatorASM: usbCOloop: - out OSCCAL, try +#if OSCCAL <64 + out OSCCAL, try +#else + sts OSCCAL, try +#endif nop ; Delay values = F_CPU * 999e-6 / 5 + 0.5 @@ -153,13 +157,17 @@ usbCOclocktoohigh: ; stp = 2^x (x=0..6) during binary search, ; stp = 1 during neighbourhood search - brne usbCObinarysearch - ldi stp, 64 ; stp=64 to initiate binary search. + brne usbCObinarysearch + ldi stp, 64 ; stp=64 to initiate binary search. ; If we are in neighbourhood search (c=1), it is changed to 1 below - brcc usbCObinarysearch - cp opD, cnt16L - brcs usbCOnoimprovement - in opV, OSCCAL + brcc usbCObinarysearch + cp opD, cnt16L + brcs usbCOnoimprovement +#if OSCCAL <64 + in opV, OSCCAL +#else + lds opV, OSCCAL +#endif mov opD, cnt16L usbCOnoimprovement: ldi stp, 1 ; stp=1 to continue with neighbourhood search @@ -167,8 +175,12 @@ usbCObinarysearch: subi i, 1 brne usbCOloop - out OSCCAL, opV - nop +#if OSCCAL <64 + out OSCCAL, opV +#else + sts OSCCAL, opV +#endif + nop ret #endif //OSCCAL_HAVE_XTAL |