From jassenbaum at htp-tel.de Tue Jan 1 09:23:52 2008 From: jassenbaum at htp-tel.de (Johannes Assenbaum) Date: Tue Jan 1 09:38:34 2008 Subject: [Icc-avr] Happy 2008 References: <476BA6C5.9000004@zetnet.co.uk> Message-ID: Hi out there ,-) I wish you all the best for the new year. Johannes From andrew_166 at msn.com Tue Jan 1 09:46:54 2008 From: andrew_166 at msn.com (Andrew) Date: Tue Jan 1 10:00:51 2008 Subject: [Icc-avr] Interrupt Help Please (Happy New Year) Message-ID: Hi, Can somebody explain/show how i can get an interrupt on a pin change. I am using the AT90USB162 and the pin i need to monitor for change is on PORTD 1 which is INT1. Basically i need to go to sleep if it goes from low to high. and wake if it goes from high to low. I think the code should be something like this :- #pragma interrupt_handler XXXX_isr:XX void Pin_State_Change(void) { CHECK THE STATE OF THE PIN IF (PIN STATE HAS CHANGED) { MAKE PIN_FLAG = 0X02 } void main() { if (pin_changed == 0x01) { SMCR = 5; asm("sleep"); } } I could just using polling in my main code to check the Pin state has changed but then if i call: - asm("sleep"); how do i get the AVR to wake up again and re-enable all the devices?? If somebody has an example of pin interrupts they can send that will help me understand them and the sleep function that would be much appriceated. Many Thanks (Happy New Year ALL) Andrew -------------- next part -------------- An HTML attachment was scrubbed... URL: http://dragonsgate.net/pipermail/icc-avr/attachments/20080101/56cd9838/attachment.html From jassenbaum at htp-tel.de Tue Jan 1 12:51:09 2008 From: jassenbaum at htp-tel.de (Johannes Assenbaum) Date: Tue Jan 1 13:05:52 2008 Subject: [Icc-avr] Interrupt Help Please (Happy New Year) References: Message-ID: Hi Andrew, as datasheet tells, only INT7..4 level interrupts are able to wake up CPU from sleep mode other than idle. As I understand, this will not fit your needs. Best regards, Johannes > Hi, > Can somebody explain/show how i can get an interrupt on a pin change. I am using > the AT90USB162 and the pin i need to monitor for change is on PORTD 1 which is > INT1. > Basically i need to go to sleep if it goes from low to high. and wake if it goes > from high to low. I think the code should be something like this :- > #pragma interrupt_handler XXXX_isr:XX > void Pin_State_Change(void) > { > CHECK THE STATE OF THE PIN > IF (PIN STATE HAS CHANGED) > { > MAKE PIN_FLAG = 0X02 > } > void main() > { > if (pin_changed == 0x01) > { > SMCR = 5; > asm("sleep"); > } > } > I could just using polling in my main code to check the Pin state has changed but > then if i call: - > asm("sleep"); > how do i get the AVR to wake up again and re-enable all the devices?? > If somebody has an example of pin interrupts they can send that will help me > understand them and the sleep function that would be much appriceated. > Many Thanks (Happy New Year ALL) > Andrew From j_baraclough at zetnet.co.uk Tue Jan 1 15:53:30 2008 From: j_baraclough at zetnet.co.uk (John Baraclough) Date: Tue Jan 1 16:07:49 2008 Subject: [Icc-avr] Interrupt Help Please (Happy New Year) In-Reply-To: References: Message-ID: <477AD27A.10606@zetnet.co.uk> Hi Johannes, Actually page 84 of the AT90USB162 data sheet says: /*When the external interrupt is enabled and is configured as level triggered, the interrupt will trigger as long as the pin is held low. Note that recognition of falling or rising edge interrupts on INT7:4 requires the presence of an I/O clock, described in ?System Clock and Clock Options? on page 25. Low level interrupts and the edge interrupt on INT3:0 are detected asynchronously. This implies that these interrupts can be used for waking the part also from sleep modes other than Idle mode. The I/O clock is halted in all sleep modes except Idle mode.* / So INT7..4 can only wake up the part from all sleep modes if it is used as a level interrupt and that level is maintained until the part has completed the wake-up. INT3..0 can be used as edge or level triggered interrupts to wake up the part from all sleep modes as they are detected asynchronously. INT1 cannot be used as a pin-change interrupt, but must be programmed to respond to a defined edge or level. According to Andrew's specification in his original post this is fine. At startup, first check that the level is not high already and then set the interrupt to respond to a rising edge. If you don't do the first check then the interrupt may never be triggered. When a rising edge is detected, in the ISR reset the interrupt to respond to a falling edge and set a semaphore for 'main()' that indicates the edge has been seen. 'main()' must then tidy up everything before executing the 'sleep' command. HTH All the best for now, John Johannes Assenbaum wrote: > Hi Andrew, > > as datasheet tells, only INT7..4 level interrupts are able to wake up CPU from sleep mode other than idle. > > As I understand, this will not fit your needs. > > Best regards, > Johannes > > From andrew_166 at msn.com Wed Jan 2 02:18:55 2008 From: andrew_166 at msn.com (Andrew) Date: Wed Jan 2 02:32:53 2008 Subject: [Icc-avr] Interrupt Help Please (Happy New Year) References: <477AD27A.10606@zetnet.co.uk> Message-ID: Hi John, Thansk for the explanation, quick question i am using the following to turn the AT90USB162 into the lowest power sleep mode: - SPCR = 0x00; ACSR |= 0x80; UCSRB = 0x00; PRR1 |= 0x08; REGCR |= 0x01; port_init_off(); SMCR = 0; SMCR = 5; asm("sleep"); Is there anything else i am missing? Quick Question regarding sleep mode - when the device is in sleep mode is there anyhting else that can wake-up the AVR apart from an interrupt? also how do i set the interrupt for INT1? I think i write the folowing register to the following : - EIMSK |= 0x02; and then in the main code how do i write the C interrupt handler call code? for example when i use the application builder to set up a timer for example it produces the following code: - #pragma interrupt_handler timer1_ovf_isr:19 void timer1_ovf_isr(void) { } But as there is no application builder for the AT90USB162 as yet how would i wite the above for a pin interrupt on INT1. Note Sorry i know there is information in the datasheet but as i am new to the world of AVR's i was just wondering if somebody could help me on this. Thansk Andy ----- Original Message ----- From: "John Baraclough" To: "Johannes Assenbaum" ; "Discussion list for ICCAVR and ICCtiny Users. You do NOT need tosubscribe to icc-announce if you are a member of this." Sent: Tuesday, January 01, 2008 11:53 PM Subject: Re: [Icc-avr] Interrupt Help Please (Happy New Year) > Hi Johannes, > > Actually page 84 of the AT90USB162 data sheet says: > > /*When the external interrupt is enabled and is configured as level > triggered, the interrupt will trigger as long as the pin is held low. Note > that recognition of falling or rising edge interrupts on INT7:4 requires > the presence of an I/O clock, described in ?System Clock and Clock > Options? on page 25. Low level interrupts and the edge interrupt on > INT3:0 are detected asynchronously. This implies that these interrupts can > be used for waking the part also from sleep modes other than Idle mode. > The I/O clock is halted in all sleep modes except Idle mode.* > / > So INT7..4 can only wake up the part from all sleep modes if it is used as > a level interrupt and that level is maintained until the part has > completed the wake-up. INT3..0 can be used as edge or level triggered > interrupts to wake up the part from all sleep modes as they are detected > asynchronously. > > INT1 cannot be used as a pin-change interrupt, but must be programmed to > respond to a defined edge or level. According to Andrew's specification in > his original post this is fine. At startup, first check that the level is > not high already and then set the interrupt to respond to a rising edge. > If you don't do the first check then the interrupt may never be triggered. > When a rising edge is detected, in the ISR reset the interrupt to respond > to a falling edge and set a semaphore for 'main()' that indicates the edge > has been seen. 'main()' must then tidy up everything before executing the > 'sleep' command. > > HTH > > All the best for now, > John > > > Johannes Assenbaum wrote: >> Hi Andrew, >> >> as datasheet tells, only INT7..4 level interrupts are able to wake up CPU >> from sleep mode other than idle. >> >> As I understand, this will not fit your needs. >> >> Best regards, >> Johannes >> >> > > _______________________________________________ > Icc-avr mailing list > Icc-avr@imagecraft.com > http://dragonsgate.net/mailman/listinfo/icc-avr > From bobgardner at aol.com Wed Jan 2 07:26:01 2008 From: bobgardner at aol.com (bobgardner@aol.com) Date: Wed Jan 2 07:40:19 2008 Subject: [Icc-avr] Interrupt Help Please (Happy New Year) In-Reply-To: References: <477AD27A.10606@zetnet.co.uk> Message-ID: <8CA1B6AEAC3DE98-BD0-1ED@FWM-M14.sysops.aol.com> Latest version 7.15 has M162 in app builder. Which version do you have? ================================ But as there is no application builder for the AT90USB162 as yet how would i wite the above for a pin interrupt on INT1. Note Sorry i know there is information in the datasheet but as i am new to the world of AVR's i was just wondering if somebody could help me on this.? ? ? Thansk Andy? ? ________________________________________________________________________ More new features than ever. Check out the new AOL Mail ! - http://webmail.aol.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://dragonsgate.net/pipermail/icc-avr/attachments/20080102/71e0be1d/attachment.html From j_baraclough at zetnet.co.uk Wed Jan 2 08:04:12 2008 From: j_baraclough at zetnet.co.uk (John Baraclough) Date: Wed Jan 2 08:18:27 2008 Subject: [Icc-avr] Interrupt Help Please (Happy New Year) In-Reply-To: <8CA1B6AEAC3DE98-BD0-1ED@FWM-M14.sysops.aol.com> References: <477AD27A.10606@zetnet.co.uk> <8CA1B6AEAC3DE98-BD0-1ED@FWM-M14.sysops.aol.com> Message-ID: <477BB5FC.3020809@zetnet.co.uk> The USB162 has several differences from the M162. You will need to check the App Builder output against the data sheet to be sure. Andy, I will reply to your earlier post soon. John bobgardner@aol.com wrote: > Latest version 7.15 has M162 in app builder. Which version do you have? > ================================ > But as there is no application builder for the AT90USB162 as yet how > would i wite the above for a pin interrupt on INT1. Note Sorry i know > there is information in the datasheet but as i am new to the world of > AVR's i was just wondering if somebody could help me on this. > > > Thansk Andy > > ------------------------------------------------------------------------ > More new features than ever. Check out the new AOL Mail > ! > ------------------------------------------------------------------------ > > _______________________________________________ > Icc-avr mailing list > Icc-avr@imagecraft.com > http://dragonsgate.net/mailman/listinfo/icc-avr > From andrew_166 at msn.com Wed Jan 2 08:08:07 2008 From: andrew_166 at msn.com (Andrew) Date: Wed Jan 2 08:22:03 2008 Subject: [Icc-avr] Interrupt Help Please (Happy New Year) References: <477AD27A.10606@zetnet.co.uk> <8CA1B6AEAC3DE98-BD0-1ED@FWM-M14.sysops.aol.com> Message-ID: Hi, I have 7.15 yes i have noticed the M162. The question is what do i select? i baically need the AVR to resume from sleep when either PORTD0/PORTD1 (INT0/INT1) go from low to high. the question is what do i select. Andy ----- Original Message ----- From: bobgardner@aol.com To: icc-avr@imagecraft.com Sent: Wednesday, January 02, 2008 3:26 PM Subject: Re: [Icc-avr] Interrupt Help Please (Happy New Year) Latest version 7.15 has M162 in app builder. Which version do you have? ================================ But as there is no application builder for the AT90USB162 as yet how would i wite the above for a pin interrupt on INT1. Note Sorry i know there is information in the datasheet but as i am new to the world of AVR's i was just wondering if somebody could help me on this. Thansk Andy ------------------------------------------------------------------------------ More new features than ever. Check out the new AOL Mail! ------------------------------------------------------------------------------ _______________________________________________ Icc-avr mailing list Icc-avr@imagecraft.com http://dragonsgate.net/mailman/listinfo/icc-avr -------------- next part -------------- An HTML attachment was scrubbed... URL: http://dragonsgate.net/pipermail/icc-avr/attachments/20080102/51ae76aa/attachment.html From andrew_166 at msn.com Wed Jan 2 08:34:39 2008 From: andrew_166 at msn.com (Andrew) Date: Wed Jan 2 08:48:33 2008 Subject: [Icc-avr] Interrupt Help Please (Happy New Year) References: <477AD27A.10606@zetnet.co.uk> <8CA1B6AEAC3DE98-BD0-1ED@FWM-M14.sysops.aol.com> <477BB5FC.3020809@zetnet.co.uk> Message-ID: Hi John, My main code is basically this: - //----------------------------------------------------------------------------- // Sleep Function //----------------------------------------------------------------------------- void sleep_mode(void) { DF_Deep_Power_Down(); DF_Deep_Power_Down_2(); SPCR = 0x00; ACSR |= 0x80; UCSRB = 0x00; PRR1 |= 0x08; REGCR |= 0x01; PORTD = 0x00; //port_init_off(); SMCR = 0; SMCR = 5; asm("sleep"); } //----------------------------------------------------------------------------- // Main Program Loop //----------------------------------------------------------------------------- void main(void) { init_devices(); Usb_enable_regulator(); usb_scheduler_init(); sleep_mode(); while (1) { if(!TestBit(bFlags,TEST_MODE)) usb_scheduler_tasks(); } } //----------------------------------------------------------------------------- // INT0 - Interruopt Handler //----------------------------------------------------------------------------- #pragma interrupt_handler int0_isr:iv_INT0 void int0_isr(void) { //external interupt on INT0 } What i need to do is if either INT0 or INT1 go from low to high i need to wake the system from sleep and re-enable the USB and SPI, but i am having problems.INT0 goes from low to high if a USB cable is pulgged in and INT1 is high if the device switchs from a battery source to a main power source. either of these need to resut in waking the system. Then i put the system to sleep if INT1 is low and reset theinterrupts. Andy help would be good. Thanks, Andy ----- Original Message ----- From: "John Baraclough" To: "Discussion list for ICCAVR and ICCtiny Users. You do NOT need tosubscribe to icc-announce if you are a member of this." Sent: Wednesday, January 02, 2008 4:04 PM Subject: Re: [Icc-avr] Interrupt Help Please (Happy New Year) > The USB162 has several differences from the M162. You will need to check > the App Builder output against the data sheet to be sure. > > Andy, I will reply to your earlier post soon. > > John > > bobgardner@aol.com wrote: >> Latest version 7.15 has M162 in app builder. Which version do you have? >> ================================ >> But as there is no application builder for the AT90USB162 as yet how >> would i wite the above for a pin interrupt on INT1. Note Sorry i know >> there is information in the datasheet but as i am new to the world of >> AVR's i was just wondering if somebody could help me on this. Thansk >> Andy ------------------------------------------------------------------------ >> More new features than ever. Check out the new AOL Mail >> ! >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Icc-avr mailing list >> Icc-avr@imagecraft.com >> http://dragonsgate.net/mailman/listinfo/icc-avr >> > > _______________________________________________ > Icc-avr mailing list > Icc-avr@imagecraft.com > http://dragonsgate.net/mailman/listinfo/icc-avr > From j_baraclough at zetnet.co.uk Wed Jan 2 09:10:02 2008 From: j_baraclough at zetnet.co.uk (John Baraclough) Date: Wed Jan 2 09:24:17 2008 Subject: [Icc-avr] Interrupt Help Please (Happy New Year) In-Reply-To: References: <477AD27A.10606@zetnet.co.uk> Message-ID: <477BC56A.1060208@zetnet.co.uk> Andrew wrote: > Hi John, > > Thansk for the explanation, quick question i am using the following to > turn the AT90USB162 into the lowest power sleep mode: - > > SPCR = 0x00; > ACSR |= 0x80; > > UCSRB = 0x00; > PRR1 |= 0x08; > REGCR |= 0x01; > > port_init_off(); > > SMCR = 0; > SMCR = 5; > asm("sleep"); > That all looks fine, but for improved readability and portability try to use the bit names SMCR = BIT(SM1) | BIT(SE); You must include for this to work. > > > Is there anything else i am missing? > > Quick Question regarding sleep mode - when the device is in sleep mode > is there anyhting else that can wake-up the AVR apart from an > interrupt? also how do i set the interrupt for INT1? > Yes, read section 8.2 on page 42 of the data sheet to see what other sources there are and disable them accordingly. > I think i write the folowing register to the following : - > > EIMSK |= 0x02; > Assuming you only want INT1 to be active, you would be better to write: EIMSK = BIT(INT1); EICRA = BIT(ISC11) | BIT(ISC10); // Set INT1 to rising edge. > and then in the main code how do i write the C interrupt handler call > code? for example when i use the application builder to set up a timer > for example it produces the following code: - > > #pragma interrupt_handler timer1_ovf_isr:19 > void timer1_ovf_isr(void) > { > > } > Try not to use absolute numbers for interrupt references, but use the predefined macros. The names of these can be found in . #pragma interrupt_handler external_int_1:iv_EXT_INT1 void external_int_1(void) { SET_EXTERNAL_INT_FLAG; EICRA = BIT(ISC11); // Set INT1 to fallng edge. } and in your main loop if(TEST_EXTERNAL_INT_FLAG) { DoSleepStuffHere(); } > But as there is no application builder for the AT90USB162 as yet how > would i wite the above for a pin interrupt on INT1. Note Sorry i know > there is information in the datasheet but as i am new to the world of > AVR's i was just wondering if somebody could help me on this. > > > > Thansk Andy From j_baraclough at zetnet.co.uk Wed Jan 2 09:14:49 2008 From: j_baraclough at zetnet.co.uk (John Baraclough) Date: Wed Jan 2 09:29:03 2008 Subject: [Icc-avr] Interrupt Help Please (Happy New Year) In-Reply-To: References: <477AD27A.10606@zetnet.co.uk> <8CA1B6AEAC3DE98-BD0-1ED@FWM-M14.sysops.aol.com> Message-ID: <477BC689.7050801@zetnet.co.uk> Try the App builder for the M162 but be sure to check the resulting code against the data sheet. As for your interrupts and levels, that isn't what you wrote in your first mail so you'll have to modify my recent reply to set the appropriate interrupts and edges. John Andrew wrote: > Hi, > > I have 7.15 yes i have noticed the M162. The question is what do i > select? i baically need the AVR to resume from sleep when either > PORTD0/PORTD1 (INT0/INT1) go from low to high. the question is what do > i select. > > Andy From j_baraclough at zetnet.co.uk Wed Jan 2 09:24:37 2008 From: j_baraclough at zetnet.co.uk (John Baraclough) Date: Wed Jan 2 09:38:52 2008 Subject: [Icc-avr] Interrupt Help Please (Happy New Year) In-Reply-To: References: <477AD27A.10606@zetnet.co.uk> <8CA1B6AEAC3DE98-BD0-1ED@FWM-M14.sysops.aol.com> <477BB5FC.3020809@zetnet.co.uk> Message-ID: <477BC8D5.507@zetnet.co.uk> You need to initialise the interrupts correctly so that they respond to the appropriate edges. I once solved a problem by putting a couple of NOPs after the sleep instruction and have always done it since. I still don't know why it worked but it's just routine now. asm("sleep"); asm("nop"); asm("nop"); HTH John Andrew wrote: > Hi John, > > My main code is basically this: - > //----------------------------------------------------------------------------- > > // Sleep Function > //----------------------------------------------------------------------------- > > > > void sleep_mode(void) > { > > DF_Deep_Power_Down(); > DF_Deep_Power_Down_2(); > > SPCR = 0x00; > ACSR |= 0x80; > > UCSRB = 0x00; > PRR1 |= 0x08; > REGCR |= 0x01; > > PORTD = 0x00; > > //port_init_off(); > > SMCR = 0; > SMCR = 5; > asm("sleep"); > } > > //----------------------------------------------------------------------------- > > // Main Program Loop > //----------------------------------------------------------------------------- > > void main(void) > { > > init_devices(); > > Usb_enable_regulator(); > usb_scheduler_init(); > > sleep_mode(); > > while (1) > { > > > if(!TestBit(bFlags,TEST_MODE)) > usb_scheduler_tasks(); > > } > } > > //----------------------------------------------------------------------------- > > // INT0 - Interruopt Handler > //----------------------------------------------------------------------------- > > #pragma interrupt_handler int0_isr:iv_INT0 > void int0_isr(void) > { > //external interupt on INT0 > } > > What i need to do is if either INT0 or INT1 go from low to high i need > to wake the system from sleep and re-enable the USB and SPI, but i am > having problems.INT0 goes from low to high if a USB cable is pulgged > in and INT1 is high if the device switchs from a battery source to a > main power source. either of these need to resut in waking the system. > Then i put the system to sleep if INT1 is low and reset theinterrupts. > Andy help would be good. > > Thanks, > > Andy From jassenbaum at htp-tel.de Wed Jan 2 12:28:47 2008 From: jassenbaum at htp-tel.de (Johannes Assenbaum) Date: Wed Jan 2 12:43:38 2008 Subject: [Icc-avr] Interrupt Help Please (Happy New Year) References: <477BB5FC.3020809@zetnet.co.uk> <477BC8D5.507@zetnet.co.uk> Message-ID: You still may need to enable interrupts by SEI(); or asm("sei"); before entering sleep mode. Best regards, Johannes > You need to initialise the interrupts correctly so that they respond to > the appropriate edges. > I once solved a problem by putting a couple of NOPs after the sleep > instruction and have always done it since. I still don't know why it > worked but it's just routine now. > asm("sleep"); > asm("nop"); > asm("nop"); > HTH > John > Andrew wrote: >> Hi John, >> >> My main code is basically this: - >> //----------------------------------------------------------------------------- >> >> // Sleep Function >> //----------------------------------------------------------------------------- >> >> >> >> void sleep_mode(void) >> { >> >> DF_Deep_Power_Down(); >> DF_Deep_Power_Down_2(); >> >> SPCR = 0x00; >> ACSR |= 0x80; >> >> UCSRB = 0x00; >> PRR1 |= 0x08; >> REGCR |= 0x01; >> >> PORTD = 0x00; >> >> //port_init_off(); >> >> SMCR = 0; >> SMCR = 5; >> asm("sleep"); >> } >> >> //----------------------------------------------------------------------------- >> >> // Main Program Loop >> //----------------------------------------------------------------------------- >> >> void main(void) >> { >> >> init_devices(); >> >> Usb_enable_regulator(); >> usb_scheduler_init(); >> >> sleep_mode(); >> >> while (1) >> { >> >> >> if(!TestBit(bFlags,TEST_MODE)) >> usb_scheduler_tasks(); >> >> } >> } >> >> //----------------------------------------------------------------------------- >> >> // INT0 - Interruopt Handler >> //----------------------------------------------------------------------------- >> >> #pragma interrupt_handler int0_isr:iv_INT0 >> void int0_isr(void) >> { >> //external interupt on INT0 >> } >> >> What i need to do is if either INT0 or INT1 go from low to high i need >> to wake the system from sleep and re-enable the USB and SPI, but i am >> having problems.INT0 goes from low to high if a USB cable is pulgged >> in and INT1 is high if the device switchs from a battery source to a >> main power source. either of these need to resut in waking the system. >> Then i put the system to sleep if INT1 is low and reset theinterrupts. >> Andy help would be good. >> >> Thanks, >> >> Andy > _______________________________________________ > Icc-avr mailing list > Icc-avr@imagecraft.com > http://dragonsgate.net/mailman/listinfo/icc-avr > -- > No virus found in this incoming message. > Checked by AVG Free Edition. > Version: 7.5.516 / Virus Database: 269.17.13/1206 - Release Date: 01.01.08 12:09 From andrew_166 at msn.com Thu Jan 3 06:27:35 2008 From: andrew_166 at msn.com (Andrew) Date: Thu Jan 3 06:41:30 2008 Subject: [Icc-avr] Interrupt Help Please (Happy New Year) References: <477AD27A.10606@zetnet.co.uk> <8CA1B6AEAC3DE98-BD0-1ED@FWM-M14.sysops.aol.com> <477BB5FC.3020809@zetnet.co.uk> <477BC8D5.507@zetnet.co.uk> Message-ID: Hi john/anybody , I have a intresting/anoying problem. to recap. I have an AT90USB162. i am basically trying to send the processor to sleep if Bit 1 on PORTD is high and wake when the PIN goes low. The basically tells the processor it has lost main power and is now running on a battery. I have the code working well and i am getting 7.12uA when the Processor is asleep.and my pin interrupt routine works and wakes the processor if PORTD BIT1 is low and returns back to the 7.12uA when PORTD BIT1 is high. The problem i have is when i pug the USB in. This also has the same effect on PORTD BIT 1 as it now takes over powring the system from the battery. So as before if the USB connector is pugged in PORDT BIT 1 goes low and the processor resumes from sleep. this also works and i can use the USB port as a serial emulator using some atmel exmaple code. The probelm comes when i unplug the USB connector. Which sends PORTD BIT 1 high and thus the processor goes to sleep but it only goes down to 119uA not the 7.12uA i was getting before. I have checked and the processor is asleep as the external oscillator is turnned off. So some part of the USB must be still enabled. Can anybody suggest a solution: - CODE NOTE : - #define USB_CONNECTED (PIND & 0x01) #define BAT_CONNECTED (PIND & 0x02) are defined in a sepearte c file. void sleep(void); void wake(void); //----------------------------------------------------------------------------- // // Function name : Sleep // // Returns : None // // Parameters : None // // Purpose : Send the processor into sleep mode (Low power) // //----------------------------------------------------------------------------- void sleep(void) { SPCR = 0x00; // Power Down the SPI UCSRB = 0x00; // NOT FOUND THIS IN THe DATASHEET REGCR = 0x01; // Disable the USB Regulator RTC_POWER_OFF // Turn the Power too the RTC OFF (PORTD4) EICRA = 0x08; // Change INT1 Pin Interrupt to Falling Edge (INT1) PRR1 = 0x81; // Turn Off the USB and USART using the power reduction register SMCR = 0; // Clear SMCR Register SMCR = 0x05; // Configure Sleep Register for Deep Sleep asm("sleep"); // Put Processor into Deep Sleep } //----------------------------------------------------------------------------- // // Function name : Wake // // Returns : // // Parameters : // // Purpose : Return from Sleep mode and restart devices // //----------------------------------------------------------------------------- void wake (void) { PRR1 = 0x00; // Restart the USB from Power Reduction Mode EICRA = 0x0C; // Change the Battery on pin to interrupt on rising edge (INT1) RTC_POWER_ON // Turn the RTC Power Supply back on (PORTD4) UCSRB = 0x98; // HAVE NO IDEA WHAT THIS REGISTRY IS FOR SPCR = 0x5C; // Restart the SPI Usb_enable_regulator(); // Enable the USB regulator } //----------------------------------------------------------------------------- // Main Program Loop //----------------------------------------------------------------------------- void main(void) { init_devices(); // Initilise all the devices Usb_enable_regulator(); // Enable the USB Regulator usb_scheduler_init(); // Set up the USB Scheduler while (1) { if(USB_CONNECTED) // If the USB Connected Pin is High { usb_scheduler_tasks(); // Schedule the USB tasks } if(BAT_CONNECTED) // If the Battery Connected Pin is high { sleep(); // Call the Sleep function NOP(); // Small Delay NOP(); // Small Delay wake(); // Wake from Sleep and restart USB and SPI } } } Andy -------------- next part -------------- An HTML attachment was scrubbed... URL: http://dragonsgate.net/pipermail/icc-avr/attachments/20080103/2df00386/attachment.html From j_baraclough at zetnet.co.uk Thu Jan 3 07:37:54 2008 From: j_baraclough at zetnet.co.uk (John Baraclough) Date: Thu Jan 3 07:57:12 2008 Subject: [Icc-avr] Interrupt Help Please (Happy New Year) In-Reply-To: References: <477AD27A.10606@zetnet.co.uk> <8CA1B6AEAC3DE98-BD0-1ED@FWM-M14.sysops.aol.com> <477BB5FC.3020809@zetnet.co.uk> <477BC8D5.507@zetnet.co.uk> Message-ID: <477D0152.9030702@zetnet.co.uk> The processor is clearly in a different state when it goes to sleep from when it first starts up. At a guess, I would say you are leaving a port pin enabled and driving a low level out to a pull-up resistor (possibly more than one). Calculating the extra current; 112uA would be the current drawn through a 47k resistor from a 5V supply (or 30k and 3.3V). What is the mechanism for turning off the RTC? The ideal way to do this is to use a resistive pull-up/pull-down to turn off the RTC and then overdrive it with the appropriate level from a port pin to turn it on. When the processor goes to sleep just tri-state all the port pins so there is no current drawn. HTH John Andrew wrote: > Hi john/anybody , > > I have a intresting/anoying problem. to recap. I have an AT90USB162. i > am basically trying to send the processor to sleep if Bit 1 on PORTD > is high and wake when the PIN goes low. The basically tells the > processor it has lost main power and is now running on a battery. > > I have the code working well and i am getting 7.12uA when the > Processor is asleep.and my pin interrupt routine works and wakes the > processor if PORTD BIT1 is low and returns back to the 7.12uA when > PORTD BIT1 is high. The problem i have is when i pug the USB in. This > also has the same effect on PORTD BIT 1 as it now takes over powring > the system from the battery. > > So as before if the USB connector is pugged in PORDT BIT 1 goes low > and the processor resumes from sleep. this also works and i can use > the USB port as a serial emulator using some atmel exmaple code. The > probelm comes when i unplug the USB connector. Which sends PORTD BIT 1 > high and thus the processor goes to sleep but it only goes down to > 119uA not the 7.12uA i was getting before. I have checked and the > processor is asleep as the external oscillator is turnned off. So some > part of the USB must be still enabled. Can anybody suggest a solution: - > > CODE > > NOTE : - > > #define USB_CONNECTED (PIND & 0x01) > #define BAT_CONNECTED (PIND & 0x02) > > are defined in a sepearte c file. > > > * * > > *void* sleep(*void*); > *void* wake(*void*); > > //----------------------------------------------------------------------------- > // > // Function name : Sleep > // > // Returns : None > // > // Parameters : None > // > // Purpose : Send the processor into sleep mode (Low power) > // > //----------------------------------------------------------------------------- > *void* sleep(*void*) > { > > SPCR = 0x00; // Power Down the SPI > UCSRB = 0x00; // NOT FOUND THIS IN THe DATASHEET > > REGCR = 0x01; // Disable the USB Regulator > RTC_POWER_OFF // Turn the Power too the RTC OFF (PORTD4) > > EICRA = 0x08; // Change INT1 Pin Interrupt to Falling > Edge (INT1) > > PRR1 = 0x81; // Turn Off the USB and USART using > the power reduction register > > SMCR = 0; // Clear SMCR Register > SMCR = 0x05; // Configure Sleep Register for Deep Sleep > asm(/"sleep"/); // Put Processor into Deep Sleep > > } > > //----------------------------------------------------------------------------- > // > // Function name : Wake > // > // Returns : > // > // Parameters : > // > // Purpose : Return from Sleep mode and restart devices > // > //----------------------------------------------------------------------------- > *void* wake (*void*) > { > PRR1 = 0x00; // Restart the USB from Power Reduction Mode > EICRA = 0x0C; // Change the Battery on pin to interrupt > on rising edge (INT1) > RTC_POWER_ON // Turn the RTC Power Supply back on (PORTD4) > > UCSRB = 0x98; // HAVE NO IDEA WHAT THIS REGISTRY IS FOR > SPCR = 0x5C; // Restart the SPI > Usb_enable_regulator(); // Enable the USB regulator > } > > //----------------------------------------------------------------------------- > // Main Program Loop > //----------------------------------------------------------------------------- > *void* main(*void*) > { > init_devices(); // Initilise all the devices > > Usb_enable_regulator(); // Enable the USB Regulator > usb_scheduler_init(); // Set up the USB Scheduler > > *while* (1) > { > > *if*(USB_CONNECTED) // If the USB Connected Pin is High > { > usb_scheduler_tasks(); // Schedule the USB tasks > } > > *if*(BAT_CONNECTED) // If the Battery Connected Pin is high > { > sleep(); // Call the Sleep function > NOP(); // Small Delay > NOP(); // Small Delay > wake(); // Wake from Sleep and restart USB and SPI > > } > > } > } > > Andy > ------------------------------------------------------------------------ > > _______________________________________________ > Icc-avr mailing list > Icc-avr@imagecraft.com > http://dragonsgate.net/mailman/listinfo/icc-avr > From paul.aa9gg at gmail.com Thu Jan 3 07:51:03 2008 From: paul.aa9gg at gmail.com (Paul Mateer) Date: Thu Jan 3 08:05:30 2008 Subject: [Icc-avr] Interrupt Help Please (Happy New Year) In-Reply-To: References: <477AD27A.10606@zetnet.co.uk> <8CA1B6AEAC3DE98-BD0-1ED@FWM-M14.sysops.aol.com> <477BB5FC.3020809@zetnet.co.uk> <477BC8D5.507@zetnet.co.uk> Message-ID: <20f5efc40801030751h503eabafv6fdb8f608697ccd8@mail.gmail.com> Hello.... Basically "UCSRB" controls the USART rx/tx enable and interrupt enables. Jan 3, 2008 8:27 AM, Andrew wrote: > Hi john/anybody , > > I have a intresting/anoying problem. to recap. I have an AT90USB162. i am > basically trying to send the processor to sleep if Bit 1 on PORTD is high > and wake when the PIN goes low. The basically tells the processor it has > lost main power and is now running on a battery. > > I have the code working well and i am getting 7.12uA when the Processor is > asleep.and my pin interrupt routine works and wakes the processor if PORTD > BIT1 is low and returns back to the 7.12uA when PORTD BIT1 is high. The > problem i have is when i pug the USB in. This also has the same effect on > PORTD BIT 1 as it now takes over powring the system from the battery. > > So as before if the USB connector is pugged in PORDT BIT 1 goes low and > the processor resumes from sleep. this also works and i can use the USB port > as a serial emulator using some atmel exmaple code. The probelm comes when i > unplug the USB connector. Which sends PORTD BIT 1 high and thus the > processor goes to sleep but it only goes down to 119uA not the 7.12uA i > was getting before. I have checked and the processor is asleep as > the external oscillator is turnned off. So some part of the USB must be > still enabled. Can anybody suggest a solution: - > > CODE > > NOTE : - > > #define USB_CONNECTED (PIND & 0x01) > #define BAT_CONNECTED (PIND & 0x02) > > are defined in a sepearte c file. > > * > > void > * sleep(*void*); > *void* wake(*void*); > > > //----------------------------------------------------------------------------- > // > // Function name : Sleep > // > // Returns : None > // > // Parameters : None > // > // Purpose : Send the processor into sleep mode (Low power) > // > > //----------------------------------------------------------------------------- > *void* sleep(*void*) > { > > SPCR = 0x00; // Power Down the SPI > UCSRB = 0x00; // NOT FOUND THIS IN THe DATASHEET > > REGCR = 0x01; // Disable the USB Regulator > RTC_POWER_OFF // Turn the Power too the RTC OFF (PORTD4) > > EICRA = 0x08; // Change INT1 Pin Interrupt to Falling Edge > (INT1) > > PRR1 = 0x81; // Turn Off the USB and USART using the > power reduction register > > SMCR = 0; // Clear SMCR Register > SMCR = 0x05; // Configure Sleep Register for Deep Sleep > asm(*"sleep"*); // Put Processor into Deep Sleep > > } > > > //----------------------------------------------------------------------------- > // > // Function name : Wake > // > // Returns : > // > // Parameters : > // > // Purpose : Return from Sleep mode and restart devices > // > > //----------------------------------------------------------------------------- > *void* wake (*void*) > { > PRR1 = 0x00; // Restart the USB from Power Reduction Mode > EICRA = 0x0C; // Change the Battery on pin to interrupt on > rising edge (INT1) > RTC_POWER_ON // Turn the RTC Power Supply back on (PORTD4) > > UCSRB = 0x98; // HAVE NO IDEA WHAT THIS REGISTRY IS FOR > SPCR = 0x5C; // Restart the SPI > Usb_enable_regulator(); // Enable the USB regulator > } > > > //----------------------------------------------------------------------------- > // Main Program Loop > > //----------------------------------------------------------------------------- > *void* main(*void*) > { > init_devices(); // Initilise all the devices > > Usb_enable_regulator(); // Enable the USB Regulator > usb_scheduler_init(); // Set up the USB Scheduler > > *while* (1) > { > > *if*(USB_CONNECTED) // If the USB Connected Pin is High > { > usb_scheduler_tasks(); // Schedule the USB tasks > } > > *if*(BAT_CONNECTED) // If the Battery Connected Pin is high > { > sleep(); // Call the Sleep function > NOP(); // Small Delay > NOP(); // Small Delay > wake(); // Wake from Sleep and restart USB and SPI > > } > > } > } > Andy > > _______________________________________________ > Icc-avr mailing list > Icc-avr@imagecraft.com > http://dragonsgate.net/mailman/listinfo/icc-avr > > -- Paul Mateer, AA9GG Elan Engineering Corp. www.elanengr.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://dragonsgate.net/pipermail/icc-avr/attachments/20080103/dcfedb5a/attachment-0001.html From andrew_166 at msn.com Thu Jan 3 08:34:21 2008 From: andrew_166 at msn.com (Andrew) Date: Thu Jan 3 08:48:14 2008 Subject: [Icc-avr] Interrupt Help Please (Happy New Year) References: <477AD27A.10606@zetnet.co.uk> <8CA1B6AEAC3DE98-BD0-1ED@FWM-M14.sysops.aol.com> <477BB5FC.3020809@zetnet.co.uk> <477BC8D5.507@zetnet.co.uk> <477D0152.9030702@zetnet.co.uk> Message-ID: Hi john, I am actually powering the RTC from a port as it only takes 100uA ( not my desgin, more a temparay fix). The thing is the code works with out change alsong as i dont't plug in the USB. So i can make it sleep and resume from sleep all day long by swaping the power over from backup battery to power (so PORTD BIT 1 goes high and low). but if i plug in the USB connector and disconnect the USB connecor to make the processor sleep. the sleep current goes p to 112 - 120uA. Can you see something in the USB that i am not turnning off, it seems to me that the USB or some part of it is staying on. Andy ----- Original Message ----- From: "John Baraclough" To: "Discussion list for ICCAVR and ICCtiny Users. You do NOT need tosubscribe to icc-announce if you are a member of this." Sent: Thursday, January 03, 2008 3:37 PM Subject: Re: [Icc-avr] Interrupt Help Please (Happy New Year) > The processor is clearly in a different state when it goes to sleep from > when it first starts up. At a guess, I would say you are leaving a port > pin enabled and driving a low level out to a pull-up resistor (possibly > more than one). Calculating the extra current; 112uA would be the current > drawn through a 47k resistor from a 5V supply (or 30k and 3.3V). > > What is the mechanism for turning off the RTC? The ideal way to do this is > to use a resistive pull-up/pull-down to turn off the RTC and then > overdrive it with the appropriate level from a port pin to turn it on. > When the processor goes to sleep just tri-state all the port pins so there > is no current drawn. > > HTH > > John > > Andrew wrote: >> Hi john/anybody , >> I have a intresting/anoying problem. to recap. I have an AT90USB162. i >> am basically trying to send the processor to sleep if Bit 1 on PORTD is >> high and wake when the PIN goes low. The basically tells the processor it >> has lost main power and is now running on a battery. >> I have the code working well and i am getting 7.12uA when the Processor >> is asleep.and my pin interrupt routine works and wakes the processor if >> PORTD BIT1 is low and returns back to the 7.12uA when PORTD BIT1 is high. >> The problem i have is when i pug the USB in. This also has the same >> effect on PORTD BIT 1 as it now takes over powring the system from the >> battery. >> So as before if the USB connector is pugged in PORDT BIT 1 goes low and >> the processor resumes from sleep. this also works and i can use the USB >> port as a serial emulator using some atmel exmaple code. The probelm >> comes when i unplug the USB connector. Which sends PORTD BIT 1 high and >> thus the processor goes to sleep but it only goes down to 119uA not the >> 7.12uA i was getting before. I have checked and the processor is asleep >> as the external oscillator is turnned off. So some part of the USB must >> be still enabled. Can anybody suggest a solution: - >> CODE >> NOTE : - >> >> #define USB_CONNECTED (PIND & 0x01) >> #define BAT_CONNECTED (PIND & 0x02) >> >> are defined in a sepearte c file. >> >> * * >> >> *void* sleep(*void*); >> *void* wake(*void*); >> >> //----------------------------------------------------------------------------- >> // >> // Function name : Sleep >> // >> // Returns : None >> // >> // Parameters : None >> // >> // Purpose : Send the processor into sleep mode (Low power) >> // >> //----------------------------------------------------------------------------- >> *void* sleep(*void*) >> { >> >> SPCR = 0x00; // Power Down the SPI >> UCSRB = 0x00; // NOT FOUND THIS IN THe DATASHEET >> >> REGCR = 0x01; // Disable the USB Regulator >> RTC_POWER_OFF // Turn the Power too the RTC OFF (PORTD4) >> >> EICRA = 0x08; // Change INT1 Pin Interrupt to Falling Edge >> (INT1) >> >> PRR1 = 0x81; // Turn Off the USB and USART using the >> power reduction register >> >> SMCR = 0; // Clear SMCR Register >> SMCR = 0x05; // Configure Sleep Register for Deep Sleep >> asm(/"sleep"/); // Put Processor into Deep Sleep >> >> } >> >> //----------------------------------------------------------------------------- >> // >> // Function name : Wake >> // >> // Returns : >> // >> // Parameters : >> // >> // Purpose : Return from Sleep mode and restart devices >> // >> //----------------------------------------------------------------------------- >> *void* wake (*void*) >> { >> PRR1 = 0x00; // Restart the USB from Power Reduction Mode >> EICRA = 0x0C; // Change the Battery on pin to interrupt on >> rising edge (INT1) >> RTC_POWER_ON // Turn the RTC Power Supply back on (PORTD4) >> >> UCSRB = 0x98; // HAVE NO IDEA WHAT THIS REGISTRY IS FOR >> SPCR = 0x5C; // Restart the SPI >> Usb_enable_regulator(); // Enable the USB regulator >> } >> >> //----------------------------------------------------------------------------- >> // Main Program Loop >> //----------------------------------------------------------------------------- >> *void* main(*void*) >> { >> init_devices(); // Initilise all the devices >> >> Usb_enable_regulator(); // Enable the USB Regulator >> usb_scheduler_init(); // Set up the USB Scheduler >> >> *while* (1) >> { >> >> *if*(USB_CONNECTED) // If the USB Connected Pin is High >> { >> usb_scheduler_tasks(); // Schedule the USB tasks >> } >> >> *if*(BAT_CONNECTED) // If the Battery Connected Pin is high >> { >> sleep(); // Call the Sleep function >> NOP(); // Small Delay >> NOP(); // Small Delay >> wake(); // Wake from Sleep and restart USB and SPI >> >> } >> >> } >> } >> >> Andy >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Icc-avr mailing list >> Icc-avr@imagecraft.com >> http://dragonsgate.net/mailman/listinfo/icc-avr >> > > _______________________________________________ > Icc-avr mailing list > Icc-avr@imagecraft.com > http://dragonsgate.net/mailman/listinfo/icc-avr > From bobgardner at aol.com Thu Jan 3 08:26:19 2008 From: bobgardner at aol.com (bobgardner@aol.com) Date: Thu Jan 3 08:49:20 2008 Subject: [Icc-avr] latest version? Message-ID: <8CA1C3C81BDE4D6-1764-3853@mblk-d51.sysops.aol.com> home page and dl page say latest version is 7.14c... if I dl the demo, is it 7.15? ________________________________________________________________________ More new features than ever. Check out the new AOL Mail ! - http://webmail.aol.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://dragonsgate.net/pipermail/icc-avr/attachments/20080103/9ecaaa71/attachment.html From andrew_166 at msn.com Thu Jan 3 08:53:16 2008 From: andrew_166 at msn.com (Andrew) Date: Thu Jan 3 09:07:10 2008 Subject: [Icc-avr] Interrupt Help Please (Happy New Year) References: <477AD27A.10606@zetnet.co.uk> <8CA1B6AEAC3DE98-BD0-1ED@FWM-M14.sysops.aol.com> <477BB5FC.3020809@zetnet.co.uk> <477BC8D5.507@zetnet.co.uk> <477D0152.9030702@zetnet.co.uk> Message-ID: Hi How does one tri-state all the inputs? is this correct? PORTD = 0x00; DDRD = 0xFF; Andy ----- Original Message ----- From: "John Baraclough" To: "Discussion list for ICCAVR and ICCtiny Users. You do NOT need tosubscribe to icc-announce if you are a member of this." Sent: Thursday, January 03, 2008 3:37 PM Subject: Re: [Icc-avr] Interrupt Help Please (Happy New Year) > The processor is clearly in a different state when it goes to sleep from > when it first starts up. At a guess, I would say you are leaving a port > pin enabled and driving a low level out to a pull-up resistor (possibly > more than one). Calculating the extra current; 112uA would be the current > drawn through a 47k resistor from a 5V supply (or 30k and 3.3V). > > What is the mechanism for turning off the RTC? The ideal way to do this is > to use a resistive pull-up/pull-down to turn off the RTC and then > overdrive it with the appropriate level from a port pin to turn it on. > When the processor goes to sleep just tri-state all the port pins so there > is no current drawn. > > HTH > > John > > Andrew wrote: >> Hi john/anybody , >> I have a intresting/anoying problem. to recap. I have an AT90USB162. i >> am basically trying to send the processor to sleep if Bit 1 on PORTD is >> high and wake when the PIN goes low. The basically tells the processor it >> has lost main power and is now running on a battery. >> I have the code working well and i am getting 7.12uA when the Processor >> is asleep.and my pin interrupt routine works and wakes the processor if >> PORTD BIT1 is low and returns back to the 7.12uA when PORTD BIT1 is high. >> The problem i have is when i pug the USB in. This also has the same >> effect on PORTD BIT 1 as it now takes over powring the system from the >> battery. >> So as before if the USB connector is pugged in PORDT BIT 1 goes low and >> the processor resumes from sleep. this also works and i can use the USB >> port as a serial emulator using some atmel exmaple code. The probelm >> comes when i unplug the USB connector. Which sends PORTD BIT 1 high and >> thus the processor goes to sleep but it only goes down to 119uA not the >> 7.12uA i was getting before. I have checked and the processor is asleep >> as the external oscillator is turnned off. So some part of the USB must >> be still enabled. Can anybody suggest a solution: - >> CODE >> NOTE : - >> >> #define USB_CONNECTED (PIND & 0x01) >> #define BAT_CONNECTED (PIND & 0x02) >> >> are defined in a sepearte c file. >> >> * * >> >> *void* sleep(*void*); >> *void* wake(*void*); >> >> //----------------------------------------------------------------------------- >> // >> // Function name : Sleep >> // >> // Returns : None >> // >> // Parameters : None >> // >> // Purpose : Send the processor into sleep mode (Low power) >> // >> //----------------------------------------------------------------------------- >> *void* sleep(*void*) >> { >> >> SPCR = 0x00; // Power Down the SPI >> UCSRB = 0x00; // NOT FOUND THIS IN THe DATASHEET >> >> REGCR = 0x01; // Disable the USB Regulator >> RTC_POWER_OFF // Turn the Power too the RTC OFF (PORTD4) >> >> EICRA = 0x08; // Change INT1 Pin Interrupt to Falling Edge >> (INT1) >> >> PRR1 = 0x81; // Turn Off the USB and USART using the >> power reduction register >> >> SMCR = 0; // Clear SMCR Register >> SMCR = 0x05; // Configure Sleep Register for Deep Sleep >> asm(/"sleep"/); // Put Processor into Deep Sleep >> >> } >> >> //----------------------------------------------------------------------------- >> // >> // Function name : Wake >> // >> // Returns : >> // >> // Parameters : >> // >> // Purpose : Return from Sleep mode and restart devices >> // >> //----------------------------------------------------------------------------- >> *void* wake (*void*) >> { >> PRR1 = 0x00; // Restart the USB from Power Reduction Mode >> EICRA = 0x0C; // Change the Battery on pin to interrupt on >> rising edge (INT1) >> RTC_POWER_ON // Turn the RTC Power Supply back on (PORTD4) >> >> UCSRB = 0x98; // HAVE NO IDEA WHAT THIS REGISTRY IS FOR >> SPCR = 0x5C; // Restart the SPI >> Usb_enable_regulator(); // Enable the USB regulator >> } >> >> //----------------------------------------------------------------------------- >> // Main Program Loop >> //----------------------------------------------------------------------------- >> *void* main(*void*) >> { >> init_devices(); // Initilise all the devices >> >> Usb_enable_regulator(); // Enable the USB Regulator >> usb_scheduler_init(); // Set up the USB Scheduler >> >> *while* (1) >> { >> >> *if*(USB_CONNECTED) // If the USB Connected Pin is High >> { >> usb_scheduler_tasks(); // Schedule the USB tasks >> } >> >> *if*(BAT_CONNECTED) // If the Battery Connected Pin is high >> { >> sleep(); // Call the Sleep function >> NOP(); // Small Delay >> NOP(); // Small Delay >> wake(); // Wake from Sleep and restart USB and SPI >> >> } >> >> } >> } >> >> Andy >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Icc-avr mailing list >> Icc-avr@imagecraft.com >> http://dragonsgate.net/mailman/listinfo/icc-avr >> > > _______________________________________________ > Icc-avr mailing list > Icc-avr@imagecraft.com > http://dragonsgate.net/mailman/listinfo/icc-avr > From asyms at technosoft.co.uk Thu Jan 3 09:48:06 2008 From: asyms at technosoft.co.uk (Andy Syms) Date: Thu Jan 3 10:02:31 2008 Subject: [Icc-avr] V7 Licence Key In-Reply-To: Message-ID: How do I transfer the licence key between computers on version 7? There's no transfer to floppy command that I can see. -- >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >> >> Andy Syms Technosoft Systems Ltd >> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> From jassenbaum at htp-tel.de Thu Jan 3 09:57:29 2008 From: jassenbaum at htp-tel.de (Johannes Assenbaum) Date: Thu Jan 3 10:12:19 2008 Subject: [Icc-avr] Interrupt Help Please (Happy New Year) References: <477D0152.9030702@zetnet.co.uk> Message-ID: Hi Andy, latest errata (datasheet rev C) tell of "high current consumption in sleep mode". Maybe this is one of reasons for your sleep current problem. Best regards, Johannes > Hi john, > I am actually powering the RTC from a port as it only takes 100uA ( not my > desgin, more a temparay fix). > The thing is the code works with out change alsong as i dont't plug in the > USB. So i can make it sleep and resume from sleep all day long by swaping > the power over from backup battery to power (so PORTD BIT 1 goes high and > low). but if i plug in the USB connector and disconnect the USB connecor to > make the processor sleep. the sleep current goes p to 112 - 120uA. > Can you see something in the USB that i am not turnning off, it seems to me > that the USB or some part of it is staying on. > Andy > ----- Original Message ----- > From: "John Baraclough" > To: "Discussion list for ICCAVR and ICCtiny Users. You do NOT need > tosubscribe to icc-announce if you are a member of this." > > Sent: Thursday, January 03, 2008 3:37 PM > Subject: Re: [Icc-avr] Interrupt Help Please (Happy New Year) >> The processor is clearly in a different state when it goes to sleep from >> when it first starts up. At a guess, I would say you are leaving a port >> pin enabled and driving a low level out to a pull-up resistor (possibly >> more than one). Calculating the extra current; 112uA would be the current >> drawn through a 47k resistor from a 5V supply (or 30k and 3.3V). >> >> What is the mechanism for turning off the RTC? The ideal way to do this is >> to use a resistive pull-up/pull-down to turn off the RTC and then >> overdrive it with the appropriate level from a port pin to turn it on. >> When the processor goes to sleep just tri-state all the port pins so there >> is no current drawn. >> >> HTH >> >> John >> >> Andrew wrote: >>> Hi john/anybody , >>> I have a intresting/anoying problem. to recap. I have an AT90USB162. i >>> am basically trying to send the processor to sleep if Bit 1 on PORTD is >>> high and wake when the PIN goes low. The basically tells the processor it >>> has lost main power and is now running on a battery. >>> I have the code working well and i am getting 7.12uA when the Processor >>> is asleep.and my pin interrupt routine works and wakes the processor if >>> PORTD BIT1 is low and returns back to the 7.12uA when PORTD BIT1 is high. >>> The problem i have is when i pug the USB in. This also has the same >>> effect on PORTD BIT 1 as it now takes over powring the system from the >>> battery. >>> So as before if the USB connector is pugged in PORDT BIT 1 goes low and >>> the processor resumes from sleep. this also works and i can use the USB >>> port as a serial emulator using some atmel exmaple code. The probelm >>> comes when i unplug the USB connector. Which sends PORTD BIT 1 high and >>> thus the processor goes to sleep but it only goes down to 119uA not the >>> 7.12uA i was getting before. I have checked and the processor is asleep >>> as the external oscillator is turnned off. So some part of the USB must >>> be still enabled. Can anybody suggest a solution: - >>> CODE >>> NOTE : - >>> >>> #define USB_CONNECTED (PIND & 0x01) >>> #define BAT_CONNECTED (PIND & 0x02) >>> >>> are defined in a sepearte c file. >>> >>> * * >>> >>> *void* sleep(*void*); >>> *void* wake(*void*); >>> >>> //----------------------------------------------------------------------------- >>> // >>> // Function name : Sleep >>> // >>> // Returns : None >>> // >>> // Parameters : None >>> // >>> // Purpose : Send the processor into sleep mode (Low power) >>> // >>> //----------------------------------------------------------------------------- >>> *void* sleep(*void*) >>> { >>> >>> SPCR = 0x00; // Power Down the SPI >>> UCSRB = 0x00; // NOT FOUND THIS IN THe DATASHEET >>> >>> REGCR = 0x01; // Disable the USB Regulator >>> RTC_POWER_OFF // Turn the Power too the RTC OFF (PORTD4) >>> >>> EICRA = 0x08; // Change INT1 Pin Interrupt to Falling Edge >>> (INT1) >>> >>> PRR1 = 0x81; // Turn Off the USB and USART using the >>> power reduction register >>> >>> SMCR = 0; // Clear SMCR Register >>> SMCR = 0x05; // Configure Sleep Register for Deep Sleep >>> asm(/"sleep"/); // Put Processor into Deep Sleep >>> >>> } >>> >>> //----------------------------------------------------------------------------- >>> // >>> // Function name : Wake >>> // >>> // Returns : >>> // >>> // Parameters : >>> // >>> // Purpose : Return from Sleep mode and restart devices >>> // >>> //----------------------------------------------------------------------------- >>> *void* wake (*void*) >>> { >>> PRR1 = 0x00; // Restart the USB from Power Reduction Mode >>> EICRA = 0x0C; // Change the Battery on pin to interrupt on >>> rising edge (INT1) >>> RTC_POWER_ON // Turn the RTC Power Supply back on (PORTD4) >>> >>> UCSRB = 0x98; // HAVE NO IDEA WHAT THIS REGISTRY IS FOR >>> SPCR = 0x5C; // Restart the SPI >>> Usb_enable_regulator(); // Enable the USB regulator >>> } >>> >>> //----------------------------------------------------------------------------- >>> // Main Program Loop >>> //----------------------------------------------------------------------------- >>> *void* main(*void*) >>> { >>> init_devices(); // Initilise all the devices >>> >>> Usb_enable_regulator(); // Enable the USB Regulator >>> usb_scheduler_init(); // Set up the USB Scheduler >>> >>> *while* (1) >>> { >>> >>> *if*(USB_CONNECTED) // If the USB Connected Pin is High >>> { >>> usb_scheduler_tasks(); // Schedule the USB tasks >>> } >>> >>> *if*(BAT_CONNECTED) // If the Battery Connected Pin is high >>> { >>> sleep(); // Call the Sleep function >>> NOP(); // Small Delay >>> NOP(); // Small Delay >>> wake(); // Wake from Sleep and restart USB and SPI >>> >>> } >>> >>> } >>> } >>> >>> Andy >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Icc-avr mailing list >>> Icc-avr@imagecraft.com >>> http://dragonsgate.net/mailman/listinfo/icc-avr >>> >> >> _______________________________________________ >> Icc-avr mailing list >> Icc-avr@imagecraft.com >> http://dragonsgate.net/mailman/listinfo/icc-avr >> > _______________________________________________ > Icc-avr mailing list > Icc-avr@imagecraft.com > http://dragonsgate.net/mailman/listinfo/icc-avr > -- > No virus found in this incoming message. > Checked by AVG Free Edition. > Version: 7.5.516 / Virus Database: 269.17.13/1207 - Release Date: 02.01.08 11:29 From asyms at technosoft.co.uk Thu Jan 3 10:01:08 2008 From: asyms at technosoft.co.uk (Andy Syms) Date: Thu Jan 3 10:20:19 2008 Subject: [Icc-avr] latest version? In-Reply-To: <8CA1C3C81BDE4D6-1764-3853@mblk-d51.sysops.aol.com> Message-ID: Yes -----Original Message----- From: icc-avr-bounces@imagecraft.com [mailto:icc-avr-bounces@imagecraft.com]On Behalf Of bobgardner@aol.com Sent: 03 January 2008 16:26 To: icc-avr@imagecraft.com Subject: [Icc-avr] latest version? home page and dl page say latest version is 7.14c... if I dl the demo, is it 7.15? ---------------------------------------------------------------------------- -- More new features than ever. Check out the new AOL Mail! -------------- next part -------------- An HTML attachment was scrubbed... URL: http://dragonsgate.net/pipermail/icc-avr/attachments/20080103/133df25f/attachment.html From jassenbaum at htp-tel.de Thu Jan 3 10:10:00 2008 From: jassenbaum at htp-tel.de (Johannes Assenbaum) Date: Thu Jan 3 10:24:50 2008 Subject: [Icc-avr] Interrupt Help Please (Happy New Year) References: <477D0152.9030702@zetnet.co.uk> Message-ID: Setting a bit in DDR enables corresponding port pin for output. So correct io setup for all-inputs i.e. all hi-Z-state is DDRx = 0; How about reading the datasheet? Best regards, Johannes > Hi > How does one tri-state all the inputs? > is this correct? > PORTD = 0x00; > DDRD = 0xFF; > Andy > ----- Original Message ----- > From: "John Baraclough" > To: "Discussion list for ICCAVR and ICCtiny Users. You do NOT need > tosubscribe to icc-announce if you are a member of this." > > Sent: Thursday, January 03, 2008 3:37 PM > Subject: Re: [Icc-avr] Interrupt Help Please (Happy New Year) >> The processor is clearly in a different state when it goes to sleep from >> when it first starts up. At a guess, I would say you are leaving a port >> pin enabled and driving a low level out to a pull-up resistor (possibly >> more than one). Calculating the extra current; 112uA would be the current >> drawn through a 47k resistor from a 5V supply (or 30k and 3.3V). >> >> What is the mechanism for turning off the RTC? The ideal way to do this is >> to use a resistive pull-up/pull-down to turn off the RTC and then >> overdrive it with the appropriate level from a port pin to turn it on. >> When the processor goes to sleep just tri-state all the port pins so there >> is no current drawn. >> >> HTH >> >> John >> >> Andrew wrote: >>> Hi john/anybody , >>> I have a intresting/anoying problem. to recap. I have an AT90USB162. i >>> am basically trying to send the processor to sleep if Bit 1 on PORTD is >>> high and wake when the PIN goes low. The basically tells the processor it >>> has lost main power and is now running on a battery. >>> I have the code working well and i am getting 7.12uA when the Processor >>> is asleep.and my pin interrupt routine works and wakes the processor if >>> PORTD BIT1 is low and returns back to the 7.12uA when PORTD BIT1 is high. >>> The problem i have is when i pug the USB in. This also has the same >>> effect on PORTD BIT 1 as it now takes over powring the system from the >>> battery. >>> So as before if the USB connector is pugged in PORDT BIT 1 goes low and >>> the processor resumes from sleep. this also works and i can use the USB >>> port as a serial emulator using some atmel exmaple code. The probelm >>> comes when i unplug the USB connector. Which sends PORTD BIT 1 high and >>> thus the processor goes to sleep but it only goes down to 119uA not the >>> 7.12uA i was getting before. I have checked and the processor is asleep >>> as the external oscillator is turnned off. So some part of the USB must >>> be still enabled. Can anybody suggest a solution: - >>> CODE >>> NOTE : - >>> >>> #define USB_CONNECTED (PIND & 0x01) >>> #define BAT_CONNECTED (PIND & 0x02) >>> >>> are defined in a sepearte c file. >>> >>> * * >>> >>> *void* sleep(*void*); >>> *void* wake(*void*); >>> >>> //----------------------------------------------------------------------------- >>> // >>> // Function name : Sleep >>> // >>> // Returns : None >>> // >>> // Parameters : None >>> // >>> // Purpose : Send the processor into sleep mode (Low power) >>> // >>> //----------------------------------------------------------------------------- >>> *void* sleep(*void*) >>> { >>> >>> SPCR = 0x00; // Power Down the SPI >>> UCSRB = 0x00; // NOT FOUND THIS IN THe DATASHEET >>> >>> REGCR = 0x01; // Disable the USB Regulator >>> RTC_POWER_OFF // Turn the Power too the RTC OFF (PORTD4) >>> >>> EICRA = 0x08; // Change INT1 Pin Interrupt to Falling Edge >>> (INT1) >>> >>> PRR1 = 0x81; // Turn Off the USB and USART using the >>> power reduction register >>> >>> SMCR = 0; // Clear SMCR Register >>> SMCR = 0x05; // Configure Sleep Register for Deep Sleep >>> asm(/"sleep"/); // Put Processor into Deep Sleep >>> >>> } >>> >>> //----------------------------------------------------------------------------- >>> // >>> // Function name : Wake >>> // >>> // Returns : >>> // >>> // Parameters : >>> // >>> // Purpose : Return from Sleep mode and restart devices >>> // >>> //----------------------------------------------------------------------------- >>> *void* wake (*void*) >>> { >>> PRR1 = 0x00; // Restart the USB from Power Reduction Mode >>> EICRA = 0x0C; // Change the Battery on pin to interrupt on >>> rising edge (INT1) >>> RTC_POWER_ON // Turn the RTC Power Supply back on (PORTD4) >>> >>> UCSRB = 0x98; // HAVE NO IDEA WHAT THIS REGISTRY IS FOR >>> SPCR = 0x5C; // Restart the SPI >>> Usb_enable_regulator(); // Enable the USB regulator >>> } >>> >>> //----------------------------------------------------------------------------- >>> // Main Program Loop >>> //----------------------------------------------------------------------------- >>> *void* main(*void*) >>> { >>> init_devices(); // Initilise all the devices >>> >>> Usb_enable_regulator(); // Enable the USB Regulator >>> usb_scheduler_init(); // Set up the USB Scheduler >>> >>> *while* (1) >>> { >>> >>> *if*(USB_CONNECTED) // If the USB Connected Pin is High >>> { >>> usb_scheduler_tasks(); // Schedule the USB tasks >>> } >>> >>> *if*(BAT_CONNECTED) // If the Battery Connected Pin is high >>> { >>> sleep(); // Call the Sleep function >>> NOP(); // Small Delay >>> NOP(); // Small Delay >>> wake(); // Wake from Sleep and restart USB and SPI >>> >>> } >>> >>> } >>> } >>> >>> Andy >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Icc-avr mailing list >>> Icc-avr@imagecraft.com >>> http://dragonsgate.net/mailman/listinfo/icc-avr >>> >> >> _______________________________________________ >> Icc-avr mailing list >> Icc-avr@imagecraft.com >> http://dragonsgate.net/mailman/listinfo/icc-avr >> > _______________________________________________ > Icc-avr mailing list > Icc-avr@imagecraft.com > http://dragonsgate.net/mailman/listinfo/icc-avr > -- > No virus found in this incoming message. > Checked by AVG Free Edition. > Version: 7.5.516 / Virus Database: 269.17.13/1207 - Release Date: 02.01.08 11:29 From j_baraclough at zetnet.co.uk Thu Jan 3 10:12:23 2008 From: j_baraclough at zetnet.co.uk (John Baraclough) Date: Thu Jan 3 10:26:40 2008 Subject: [Icc-avr] Interrupt Help Please (Happy New Year) In-Reply-To: References: <477AD27A.10606@zetnet.co.uk> <8CA1B6AEAC3DE98-BD0-1ED@FWM-M14.sysops.aol.com> <477BB5FC.3020809@zetnet.co.uk> <477BC8D5.507@zetnet.co.uk> <477D0152.9030702@zetnet.co.uk> Message-ID: <477D2587.5060409@zetnet.co.uk> I haven't used this part and don't know the USB module, but I can see two things you aren't doing which may help. You are enabling the SPI and USART in 'wake()' and disabling them again in 'sleep()', which is fine. However when the SPI and USART are disabled the associated IO pins revert to normal port operation and will take on the level and direction held in the PORTx and DDRx registers. If these pins are driving external parts with pull-ups you may be pulling current through the pins. You need to ensure that the IO pins for the SPI and USART modules are not driving anything befor going to sleep. John Andrew wrote: > Hi john, > > I am actually powering the RTC from a port as it only takes 100uA ( > not my desgin, more a temparay fix). > > The thing is the code works with out change alsong as i dont't plug in > the USB. So i can make it sleep and resume from sleep all day long by > swaping the power over from backup battery to power (so PORTD BIT 1 > goes high and low). but if i plug in the USB connector and disconnect > the USB connecor to make the processor sleep. the sleep current goes p > to 112 - 120uA. > > Can you see something in the USB that i am not turnning off, it seems > to me that the USB or some part of it is staying on. > > Andy > > > > ----- Original Message ----- From: "John Baraclough" > > To: "Discussion list for ICCAVR and ICCtiny Users. You do NOT need > tosubscribe to icc-announce if you are a member of this." > > Sent: Thursday, January 03, 2008 3:37 PM > Subject: Re: [Icc-avr] Interrupt Help Please (Happy New Year) > > >> The processor is clearly in a different state when it goes to sleep >> from when it first starts up. At a guess, I would say you are leaving >> a port pin enabled and driving a low level out to a pull-up resistor >> (possibly more than one). Calculating the extra current; 112uA would >> be the current drawn through a 47k resistor from a 5V supply (or 30k >> and 3.3V). >> >> What is the mechanism for turning off the RTC? The ideal way to do >> this is to use a resistive pull-up/pull-down to turn off the RTC and >> then overdrive it with the appropriate level from a port pin to turn >> it on. When the processor goes to sleep just tri-state all the port >> pins so there is no current drawn. >> >> HTH >> >> John >> >> Andrew wrote: >>> Hi john/anybody , >>> I have a intresting/anoying problem. to recap. I have an >>> AT90USB162. i am basically trying to send the processor to sleep if >>> Bit 1 on PORTD is high and wake when the PIN goes low. The basically >>> tells the processor it has lost main power and is now running on a >>> battery. >>> I have the code working well and i am getting 7.12uA when the >>> Processor is asleep.and my pin interrupt routine works and wakes the >>> processor if PORTD BIT1 is low and returns back to the 7.12uA when >>> PORTD BIT1 is high. The problem i have is when i pug the USB in. >>> This also has the same effect on PORTD BIT 1 as it now takes over >>> powring the system from the battery. >>> So as before if the USB connector is pugged in PORDT BIT 1 goes low >>> and the processor resumes from sleep. this also works and i can use >>> the USB port as a serial emulator using some atmel exmaple code. The >>> probelm comes when i unplug the USB connector. Which sends PORTD BIT >>> 1 high and thus the processor goes to sleep but it only goes down to >>> 119uA not the 7.12uA i was getting before. I have checked and the >>> processor is asleep as the external oscillator is turnned off. So >>> some part of the USB must be still enabled. Can anybody suggest a >>> solution: - >>> CODE >>> NOTE : - >>> >>> #define USB_CONNECTED (PIND & 0x01) >>> #define BAT_CONNECTED (PIND & 0x02) >>> >>> are defined in a sepearte c file. >>> >>> * * >>> >>> *void* sleep(*void*); >>> *void* wake(*void*); >>> >>> //----------------------------------------------------------------------------- >>> >>> // >>> // Function name : Sleep >>> // >>> // Returns : None >>> // >>> // Parameters : None >>> // >>> // Purpose : Send the processor into sleep mode (Low power) >>> // >>> //----------------------------------------------------------------------------- >>> >>> *void* sleep(*void*) >>> { >>> >>> SPCR = 0x00; // Power Down the SPI >>> UCSRB = 0x00; // NOT FOUND THIS IN THe DATASHEET >>> >>> REGCR = 0x01; // Disable the USB Regulator >>> RTC_POWER_OFF // Turn the Power too the RTC OFF (PORTD4) >>> >>> EICRA = 0x08; // Change INT1 Pin Interrupt to Falling >>> Edge (INT1) >>> >>> PRR1 = 0x81; // Turn Off the USB and USART using >>> the power reduction register >>> >>> SMCR = 0; // Clear SMCR Register >>> SMCR = 0x05; // Configure Sleep Register for Deep >>> Sleep >>> asm(/"sleep"/); // Put Processor into Deep Sleep >>> >>> } >>> >>> //----------------------------------------------------------------------------- >>> >>> // >>> // Function name : Wake >>> // >>> // Returns : >>> // >>> // Parameters : >>> // >>> // Purpose : Return from Sleep mode and restart devices >>> // >>> //----------------------------------------------------------------------------- >>> >>> *void* wake (*void*) >>> { >>> PRR1 = 0x00; // Restart the USB from Power Reduction >>> Mode >>> EICRA = 0x0C; // Change the Battery on pin to interrupt >>> on rising edge (INT1) >>> RTC_POWER_ON // Turn the RTC Power Supply back on (PORTD4) >>> >>> UCSRB = 0x98; // HAVE NO IDEA WHAT THIS REGISTRY IS FOR >>> SPCR = 0x5C; // Restart the SPI >>> Usb_enable_regulator(); // Enable the USB regulator >>> } >>> >>> //----------------------------------------------------------------------------- >>> >>> // Main Program Loop >>> //----------------------------------------------------------------------------- >>> >>> *void* main(*void*) >>> { >>> init_devices(); // Initilise all the devices >>> >>> Usb_enable_regulator(); // Enable the USB Regulator >>> usb_scheduler_init(); // Set up the USB Scheduler >>> >>> *while* (1) >>> { >>> >>> *if*(USB_CONNECTED) // If the USB Connected Pin is High >>> { >>> usb_scheduler_tasks(); // Schedule the USB tasks >>> } >>> >>> *if*(BAT_CONNECTED) // If the Battery Connected Pin is high >>> { >>> sleep(); // Call the Sleep function >>> NOP(); // Small Delay >>> NOP(); // Small Delay >>> wake(); // Wake from Sleep and restart USB and SPI >>> >>> } >>> >>> } >>> } >>> >>> Andy >>> ------------------------------------------------------------------------ >>> >>> >>> _______________________________________________ >>> Icc-avr mailing list >>> Icc-avr@imagecraft.com >>> http://dragonsgate.net/mailman/listinfo/icc-avr >>> >> >> _______________________________________________ >> Icc-avr mailing list >> Icc-avr@imagecraft.com >> http://dragonsgate.net/mailman/listinfo/icc-avr >> > > _______________________________________________ > Icc-avr mailing list > Icc-avr@imagecraft.com > http://dragonsgate.net/mailman/listinfo/icc-avr > > From j_baraclough at zetnet.co.uk Thu Jan 3 10:21:14 2008 From: j_baraclough at zetnet.co.uk (John Baraclough) Date: Thu Jan 3 10:35:32 2008 Subject: [Icc-avr] Interrupt Help Please (Happy New Year) In-Reply-To: References: <477AD27A.10606@zetnet.co.uk> <8CA1B6AEAC3DE98-BD0-1ED@FWM-M14.sysops.aol.com> <477BB5FC.3020809@zetnet.co.uk> <477BC8D5.507@zetnet.co.uk> <477D0152.9030702@zetnet.co.uk> Message-ID: <477D279A.1040000@zetnet.co.uk> Almost, but not quite. You need to do something with MCUCR as well. You should read paragraph 11.2.3 on page 69 of the data sheet to find out more. John Andrew wrote: > Hi > > How does one tri-state all the inputs? > > is this correct? > > PORTD = 0x00; > DDRD = 0xFF; > > Andy > From j_baraclough at zetnet.co.uk Thu Jan 3 10:46:54 2008 From: j_baraclough at zetnet.co.uk (John Baraclough) Date: Thu Jan 3 11:01:10 2008 Subject: [Icc-avr] V7 Licence Key In-Reply-To: References: Message-ID: <477D2D9E.9060802@zetnet.co.uk> From the help file: *Using the Product on Multiple Computers If you need to use the product on multiple computers, such as on an office PC and a laptop, and if you are the only user of the product, you may obtain a separate license from us. Contact us for details. Alternatively, you may purchase the hardware dongle. * HTH John Andy Syms wrote: > How do I transfer the licence key between computers on version 7? There's > no transfer to floppy command that I can see. > > -- > >>> Andy Syms Technosoft Systems Ltd >>> From richard-lists at imagecraft.com Thu Jan 3 12:03:35 2008 From: richard-lists at imagecraft.com (Richard Man) Date: Thu Jan 3 12:18:09 2008 Subject: [Icc-avr] latest version? In-Reply-To: <8CA1C3C81BDE4D6-1764-3853@mblk-d51.sysops.aol.com> References: <8CA1C3C81BDE4D6-1764-3853@mblk-d51.sysops.aol.com> Message-ID: <200801032018.m03KI7If083653@dragonsgate2.imagecraft.com> That Richard guy, I am going to fire him soon. He keeps forgetting to change the entry on the database. Thanks and fixed. It's 7.15. At 08:26 AM 1/3/2008, you wrote: >home page and dl page say latest version is 7.14c... if I dl the >demo, is it 7.15? // richard (This email is for mailing lists. To reach me directly, please use richard at imagecraft.com) From Albert.vanVeen at pertronic.co.nz Thu Jan 3 12:04:38 2008 From: Albert.vanVeen at pertronic.co.nz (Albert vanVeen) Date: Thu Jan 3 12:18:44 2008 Subject: [Icc-avr] Interrupt Help Please (Happy New Year) In-Reply-To: References: <477D0152.9030702@zetnet.co.uk> Message-ID: Yes, you're right: writing/reading emails must take as must time as just reading the datasheet. "Being new" is no excuse for not reading it, it is the ultimate reason. When I took over my first AVR project from a colleague 2 years ago, I spent most of the first day reading the datasheet to see what the characteristics and possibilities are. This is not a waste of time, but a good investment! And: happy new year everyone. Albert. -----Original Message----- From: icc-avr-bounces@imagecraft.com [mailto:icc-avr-bounces@imagecraft.com] On Behalf Of Johannes Assenbaum Sent: Friday, January 04, 2008 07:10 AM To: icc-avr@imagecraft.com Subject: Re: [Icc-avr] Interrupt Help Please (Happy New Year) Setting a bit in DDR enables corresponding port pin for output. So correct io setup for all-inputs i.e. all hi-Z-state is DDRx = 0; How about reading the datasheet? Best regards, Johannes > Hi > How does one tri-state all the inputs? > is this correct? > PORTD = 0x00; > DDRD = 0xFF; > Andy > ----- Original Message ----- > From: "John Baraclough" > To: "Discussion list for ICCAVR and ICCtiny Users. You do NOT need > tosubscribe to icc-announce if you are a member of this." > > Sent: Thursday, January 03, 2008 3:37 PM > Subject: Re: [Icc-avr] Interrupt Help Please (Happy New Year) >> The processor is clearly in a different state when it goes to sleep >> from when it first starts up. At a guess, I would say you are leaving >> a port pin enabled and driving a low level out to a pull-up resistor >> (possibly more than one). Calculating the extra current; 112uA would >> be the current drawn through a 47k resistor from a 5V supply (or 30k and 3.3V). >> >> What is the mechanism for turning off the RTC? The ideal way to do >> this is to use a resistive pull-up/pull-down to turn off the RTC and >> then overdrive it with the appropriate level from a port pin to turn it on. >> When the processor goes to sleep just tri-state all the port pins so >> there is no current drawn. >> >> HTH >> >> John >> >> Andrew wrote: >>> Hi john/anybody , >>> I have a intresting/anoying problem. to recap. I have an >>> AT90USB162. i am basically trying to send the processor to sleep if >>> Bit 1 on PORTD is high and wake when the PIN goes low. The basically >>> tells the processor it has lost main power and is now running on a battery. >>> I have the code working well and i am getting 7.12uA when the >>> Processor is asleep.and my pin interrupt routine works and wakes the >>> processor if PORTD BIT1 is low and returns back to the 7.12uA when PORTD BIT1 is high. >>> The problem i have is when i pug the USB in. This also has the same >>> effect on PORTD BIT 1 as it now takes over powring the system from >>> the battery. >>> So as before if the USB connector is pugged in PORDT BIT 1 goes low >>> and the processor resumes from sleep. this also works and i can use >>> the USB port as a serial emulator using some atmel exmaple code. The >>> probelm comes when i unplug the USB connector. Which sends PORTD BIT >>> 1 high and thus the processor goes to sleep but it only goes down to >>> 119uA not the 7.12uA i was getting before. I have checked and the >>> processor is asleep as the external oscillator is turnned off. So >>> some part of the USB must be still enabled. Can anybody suggest a >>> solution: - CODE NOTE : - >>> >>> #define USB_CONNECTED (PIND & 0x01) >>> #define BAT_CONNECTED (PIND & 0x02) >>> >>> are defined in a sepearte c file. >>> >>> * * >>> >>> *void* sleep(*void*); >>> *void* wake(*void*); >>> >>> //------------------------------------------------------------------ >>> ----------- >>> // >>> // Function name : Sleep >>> // >>> // Returns : None >>> // >>> // Parameters : None >>> // >>> // Purpose : Send the processor into sleep mode (Low power) // >>> //------------------------------------------------------------------ >>> ----------- >>> *void* sleep(*void*) >>> { >>> >>> SPCR = 0x00; // Power Down the SPI >>> UCSRB = 0x00; // NOT FOUND THIS IN THe DATASHEET >>> >>> REGCR = 0x01; // Disable the USB Regulator >>> RTC_POWER_OFF // Turn the Power too the RTC OFF (PORTD4) >>> >>> EICRA = 0x08; // Change INT1 Pin Interrupt to Falling Edge >>> (INT1) >>> >>> PRR1 = 0x81; // Turn Off the USB and USART using the >>> power reduction register >>> >>> SMCR = 0; // Clear SMCR Register >>> SMCR = 0x05; // Configure Sleep Register for Deep Sleep >>> asm(/"sleep"/); // Put Processor into Deep Sleep >>> >>> } >>> >>> //------------------------------------------------------------------ >>> ----------- >>> // >>> // Function name : Wake >>> // >>> // Returns : >>> // >>> // Parameters : >>> // >>> // Purpose : Return from Sleep mode and restart devices // >>> //------------------------------------------------------------------ >>> ----------- >>> *void* wake (*void*) >>> { >>> PRR1 = 0x00; // Restart the USB from Power Reduction Mode >>> EICRA = 0x0C; // Change the Battery on pin to interrupt on >>> rising edge (INT1) >>> RTC_POWER_ON // Turn the RTC Power Supply back on (PORTD4) >>> >>> UCSRB = 0x98; // HAVE NO IDEA WHAT THIS REGISTRY IS FOR >>> SPCR = 0x5C; // Restart the SPI >>> Usb_enable_regulator(); // Enable the USB regulator >>> } >>> >>> //------------------------------------------------------------------ >>> ----------- >>> // Main Program Loop >>> //------------------------------------------------------------------ >>> ----------- >>> *void* main(*void*) >>> { >>> init_devices(); // Initilise all the devices >>> >>> Usb_enable_regulator(); // Enable the USB Regulator >>> usb_scheduler_init(); // Set up the USB Scheduler >>> >>> *while* (1) >>> { >>> >>> *if*(USB_CONNECTED) // If the USB Connected Pin is High { >>> usb_scheduler_tasks(); // Schedule the USB tasks >>> } >>> >>> *if*(BAT_CONNECTED) // If the Battery Connected Pin is high { >>> sleep(); // Call the Sleep function NOP(); // Small Delay NOP(); // >>> Small Delay wake(); // Wake from Sleep and restart USB and SPI >>> >>> } >>> >>> } >>> } >>> >>> Andy >>> -------------------------------------------------------------------- >>> ---- >>> >>> _______________________________________________ >>> Icc-avr mailing list >>> Icc-avr@imagecraft.com >>> http://dragonsgate.net/mailman/listinfo/icc-avr >>> >> >> _______________________________________________ >> Icc-avr mailing list >> Icc-avr@imagecraft.com >> http://dragonsgate.net/mailman/listinfo/icc-avr >> > _______________________________________________ > Icc-avr mailing list > Icc-avr@imagecraft.com > http://dragonsgate.net/mailman/listinfo/icc-avr > -- > No virus found in this incoming message. > Checked by AVG Free Edition. > Version: 7.5.516 / Virus Database: 269.17.13/1207 - Release Date: > 02.01.08 11:29 _______________________________________________ Icc-avr mailing list Icc-avr@imagecraft.com http://dragonsgate.net/mailman/listinfo/icc-avr Scanned by Bizo Email Filter From richard-lists at imagecraft.com Thu Jan 3 12:05:10 2008 From: richard-lists at imagecraft.com (Richard Man) Date: Thu Jan 3 12:19:43 2008 Subject: [Icc-avr] V7 Licence Key In-Reply-To: References: Message-ID: <200801032019.m03KJgWK083681@dragonsgate2.imagecraft.com> On the old machine, Help->"Register Software" then click on Uninstall button on lower left. On the new machine, Help->"Register Software" send us both set of reported data and we will send you a new license key. Yes, we are thinking about automating this process.. At 09:48 AM 1/3/2008, Andy Syms wrote: >How do I transfer the licence key between computers on version 7? There's >no transfer to floppy command that I can see. // richard (This email is for mailing lists. To reach me directly, please use richard at imagecraft.com) From andrew_166 at msn.com Thu Jan 3 12:37:30 2008 From: andrew_166 at msn.com (Andrew) Date: Thu Jan 3 12:51:23 2008 Subject: [Icc-avr] Interrupt Help Please (Happy New Year) References: <477AD27A.10606@zetnet.co.uk> <8CA1B6AEAC3DE98-BD0-1ED@FWM-M14.sysops.aol.com> <477BB5FC.3020809@zetnet.co.uk> <477BC8D5.507@zetnet.co.uk> <477D0152.9030702@zetnet.co.uk> <477D279A.1040000@zetnet.co.uk> Message-ID: Hi john, i should have read that section in the datahseet kinda sick of looking at it though. my sleep function is now as follows and i still have the same probelm: - void sleep(void) { DF_Deep_Power_Down(); // Put DataFlash one in deep sleep DF_Deep_Power_Down_2 (); // Put DataFlash two in deep sleep TCCR1B = 0x00; // Stop timer TIMSK1 = 0x00; // Disable Timer Intterupts DDRB = 0x00; // Tri-State PORTB DDRC = 0x00; // Tri-State PORTC DDRD = 0x00; // Tri-State PORTD PORTB = 0x00; // Make Sure the port is not pulled-up PORTC = 0x00; // Make Sure the port is not pulled-up PORTD = 0x00; // Make Sure the port is not pulled-up SPCR = 0x00; // Power Down the SPI UCSRB = 0x00; // Power Down The USART REGCR = 0x01; // Disable the USB Regulator RTC_POWER_OFF // Turn the Power too the RTC OFF (PORTD4) EICRA = 0x08; // Change INT1 Pin Interrupt to Falling Edge (INT1) PRR1 = 0x81; // Turn Off the USB and USART using the power reduction register SMCR = 0; // Clear SMCR Register SMCR = 0x05; // Configure Sleep Register for Deep Sleep asm("sleep"); // Put Processor into Deep Sleep } 7.12uA in sleep -> when the USB has never been connected to the system 120uA sometimes goes to 490uA in sleep mode -> after the USB has been connected once. I have no idea why my sleep function funcrtions this way i guess more datasheet reading joy, could just leave the sleep mode and get on with the rest of the code and go for a bigger batttery :) Andy ----- Original Message ----- From: "John Baraclough" To: "Discussion list for ICCAVR and ICCtiny Users. You do NOT need tosubscribe to icc-announce if you are a member of this." Sent: Thursday, January 03, 2008 6:21 PM Subject: Re: [Icc-avr] Interrupt Help Please (Happy New Year) > Almost, but not quite. You need to do something with MCUCR as well. You > should read paragraph 11.2.3 on page 69 of the data sheet to find out > more. > > John > > > Andrew wrote: >> Hi >> >> How does one tri-state all the inputs? >> >> is this correct? >> >> PORTD = 0x00; >> DDRD = 0xFF; >> >> Andy >> > > _______________________________________________ > Icc-avr mailing list > Icc-avr@imagecraft.com > http://dragonsgate.net/mailman/listinfo/icc-avr > From andrew_166 at msn.com Thu Jan 3 13:48:35 2008 From: andrew_166 at msn.com (Andrew) Date: Thu Jan 3 14:02:29 2008 Subject: [Icc-avr] Interrupt Help Please (Happy New Year) References: <477D0152.9030702@zetnet.co.uk> Message-ID: Hi, i have fixed it :) it now sleeps at 6uA in both conditions :) Andy ----- Original Message ----- From: "Albert vanVeen" To: "Johannes Assenbaum" ; "Discussion list for ICCAVR and ICCtiny Users. You do NOT needtosubscribeto icc-announce if you are a member of this." Sent: Thursday, January 03, 2008 8:04 PM Subject: RE: [Icc-avr] Interrupt Help Please (Happy New Year) > Yes, you're right: writing/reading emails must take as must time as just > reading the datasheet. > "Being new" is no excuse for not reading it, it is the ultimate reason. > When I took over my first AVR project from a colleague 2 years ago, I > spent most of the first day reading the datasheet to see what the > characteristics and possibilities are. This is not a waste of time, but > a good investment! > > And: happy new year everyone. > > Albert. > > > > -----Original Message----- > From: icc-avr-bounces@imagecraft.com > [mailto:icc-avr-bounces@imagecraft.com] On Behalf Of Johannes Assenbaum > Sent: Friday, January 04, 2008 07:10 AM > To: icc-avr@imagecraft.com > Subject: Re: [Icc-avr] Interrupt Help Please (Happy New Year) > > Setting a bit in DDR enables corresponding port pin for output. > > So correct io setup for all-inputs i.e. all hi-Z-state is DDRx = 0; > > How about reading the datasheet? > > Best regards, > Johannes > > >> Hi > >> How does one tri-state all the inputs? > >> is this correct? > >> PORTD = 0x00; >> DDRD = 0xFF; > >> Andy > > >> ----- Original Message ----- >> From: "John Baraclough" >> To: "Discussion list for ICCAVR and ICCtiny Users. You do NOT need >> tosubscribe to icc-announce if you are a member of this." >> >> Sent: Thursday, January 03, 2008 3:37 PM >> Subject: Re: [Icc-avr] Interrupt Help Please (Happy New Year) > > >>> The processor is clearly in a different state when it goes to sleep >>> from when it first starts up. At a guess, I would say you are leaving > >>> a port pin enabled and driving a low level out to a pull-up resistor >>> (possibly more than one). Calculating the extra current; 112uA would >>> be the current drawn through a 47k resistor from a 5V supply (or 30k > and 3.3V). >>> >>> What is the mechanism for turning off the RTC? The ideal way to do >>> this is to use a resistive pull-up/pull-down to turn off the RTC and >>> then overdrive it with the appropriate level from a port pin to turn > it on. >>> When the processor goes to sleep just tri-state all the port pins so >>> there is no current drawn. >>> >>> HTH >>> >>> John >>> >>> Andrew wrote: >>>> Hi john/anybody , >>>> I have a intresting/anoying problem. to recap. I have an >>>> AT90USB162. i am basically trying to send the processor to sleep if >>>> Bit 1 on PORTD is high and wake when the PIN goes low. The basically > >>>> tells the processor it has lost main power and is now running on a > battery. >>>> I have the code working well and i am getting 7.12uA when the >>>> Processor is asleep.and my pin interrupt routine works and wakes the > >>>> processor if PORTD BIT1 is low and returns back to the 7.12uA when > PORTD BIT1 is high. >>>> The problem i have is when i pug the USB in. This also has the same >>>> effect on PORTD BIT 1 as it now takes over powring the system from >>>> the battery. >>>> So as before if the USB connector is pugged in PORDT BIT 1 goes low > >>>> and the processor resumes from sleep. this also works and i can use >>>> the USB port as a serial emulator using some atmel exmaple code. The > >>>> probelm comes when i unplug the USB connector. Which sends PORTD BIT > >>>> 1 high and thus the processor goes to sleep but it only goes down to > >>>> 119uA not the 7.12uA i was getting before. I have checked and the >>>> processor is asleep as the external oscillator is turnned off. So >>>> some part of the USB must be still enabled. Can anybody suggest a >>>> solution: - CODE NOTE : - >>>> >>>> #define USB_CONNECTED (PIND & 0x01) >>>> #define BAT_CONNECTED (PIND & 0x02) >>>> >>>> are defined in a sepearte c file. >>>> >>>> * * >>>> >>>> *void* sleep(*void*); >>>> *void* wake(*void*); >>>> >>>> //------------------------------------------------------------------ >>>> ----------- >>>> // >>>> // Function name : Sleep >>>> // >>>> // Returns : None >>>> // >>>> // Parameters : None >>>> // >>>> // Purpose : Send the processor into sleep mode (Low power) // >>>> //------------------------------------------------------------------ >>>> ----------- >>>> *void* sleep(*void*) >>>> { >>>> >>>> SPCR = 0x00; // Power Down the SPI >>>> UCSRB = 0x00; // NOT FOUND THIS IN THe DATASHEET >>>> >>>> REGCR = 0x01; // Disable the USB Regulator >>>> RTC_POWER_OFF // Turn the Power too the RTC OFF (PORTD4) >>>> >>>> EICRA = 0x08; // Change INT1 Pin Interrupt to Falling > Edge >>>> (INT1) >>>> >>>> PRR1 = 0x81; // Turn Off the USB and USART using > the >>>> power reduction register >>>> >>>> SMCR = 0; // Clear SMCR Register >>>> SMCR = 0x05; // Configure Sleep Register for Deep > Sleep >>>> asm(/"sleep"/); // Put Processor into Deep Sleep >>>> >>>> } >>>> >>>> //------------------------------------------------------------------ >>>> ----------- >>>> // >>>> // Function name : Wake >>>> // >>>> // Returns : >>>> // >>>> // Parameters : >>>> // >>>> // Purpose : Return from Sleep mode and restart devices // >>>> //------------------------------------------------------------------ >>>> ----------- >>>> *void* wake (*void*) >>>> { >>>> PRR1 = 0x00; // Restart the USB from Power Reduction > Mode >>>> EICRA = 0x0C; // Change the Battery on pin to interrupt > on >>>> rising edge (INT1) >>>> RTC_POWER_ON // Turn the RTC Power Supply back on (PORTD4) >>>> >>>> UCSRB = 0x98; // HAVE NO IDEA WHAT THIS REGISTRY IS > FOR >>>> SPCR = 0x5C; // Restart the SPI >>>> Usb_enable_regulator(); // Enable the USB regulator >>>> } >>>> >>>> //------------------------------------------------------------------ >>>> ----------- >>>> // Main Program Loop >>>> //------------------------------------------------------------------ >>>> ----------- >>>> *void* main(*void*) >>>> { >>>> init_devices(); // Initilise all the devices >>>> >>>> Usb_enable_regulator(); // Enable the USB Regulator >>>> usb_scheduler_init(); // Set up the USB Scheduler >>>> >>>> *while* (1) >>>> { >>>> >>>> *if*(USB_CONNECTED) // If the USB Connected Pin is High { >>>> usb_scheduler_tasks(); // Schedule the USB tasks >>>> } >>>> >>>> *if*(BAT_CONNECTED) // If the Battery Connected Pin is high { >>>> sleep(); // Call the Sleep function NOP(); // Small Delay NOP(); // >>>> Small Delay wake(); // Wake from Sleep and restart USB and SPI >>>> >>>> } >>>> >>>> } >>>> } >>>> >>>> Andy >>>> -------------------------------------------------------------------- >>>> ---- >>>> >>>> _______________________________________________ >>>> Icc-avr mailing list >>>> Icc-avr@imagecraft.com >>>> http://dragonsgate.net/mailman/listinfo/icc-avr >>>> >>> >>> _______________________________________________ >>> Icc-avr mailing list >>> Icc-avr@imagecraft.com >>> http://dragonsgate.net/mailman/listinfo/icc-avr >>> > >> _______________________________________________ >> Icc-avr mailing list >> Icc-avr@imagecraft.com >> http://dragonsgate.net/mailman/listinfo/icc-avr > > >> -- >> No virus found in this incoming message. >> Checked by AVG Free Edition. >> Version: 7.5.516 / Virus Database: 269.17.13/1207 - Release Date: >> 02.01.08 11:29 > > > _______________________________________________ > Icc-avr mailing list > Icc-avr@imagecraft.com > http://dragonsgate.net/mailman/listinfo/icc-avr > > Scanned by Bizo Email Filter > > > _______________________________________________ > Icc-avr mailing list > Icc-avr@imagecraft.com > http://dragonsgate.net/mailman/listinfo/icc-avr > From jassenbaum at htp-tel.de Thu Jan 3 14:34:27 2008 From: jassenbaum at htp-tel.de (Johannes Assenbaum) Date: Thu Jan 3 14:49:18 2008 Subject: [Icc-avr] Interrupt Help Please (Happy New Year) References: <477D279A.1040000@zetnet.co.uk> Message-ID: AFIAS datasheet, errata section, in this case, tells all about power overcomsumption you asked for. Guess you really need a bigger battery until that silicon-bug gets fixed. Johannes > Hi john, > i should have read that section in the datahseet kinda sick of looking at it > though. > my sleep function is now as follows and i still have the same probelm: - > void sleep(void) > { > DF_Deep_Power_Down(); // Put DataFlash one in deep sleep > DF_Deep_Power_Down_2 (); // Put DataFlash two in deep sleep > TCCR1B = 0x00; // Stop timer > TIMSK1 = 0x00; // Disable Timer Intterupts > DDRB = 0x00; // Tri-State PORTB > DDRC = 0x00; // Tri-State PORTC > DDRD = 0x00; // Tri-State PORTD > PORTB = 0x00; // Make Sure the port is not pulled-up > PORTC = 0x00; // Make Sure the port is not pulled-up > PORTD = 0x00; // Make Sure the port is not pulled-up > SPCR = 0x00; // Power Down the SPI > UCSRB = 0x00; // Power Down The USART > REGCR = 0x01; // Disable the USB Regulator > RTC_POWER_OFF // Turn the Power too the RTC OFF (PORTD4) > EICRA = 0x08; // Change INT1 Pin Interrupt to Falling Edge (INT1) > PRR1 = 0x81; // Turn Off the USB and USART using the power reduction > register > SMCR = 0; // Clear SMCR Register > SMCR = 0x05; // Configure Sleep Register for Deep Sleep > asm("sleep"); // Put Processor into Deep Sleep > } > 7.12uA in sleep -> when the USB has never been connected to the system > 120uA sometimes goes to 490uA in sleep mode -> after the USB has been > connected once. > I have no idea why my sleep function funcrtions this way i guess more > datasheet reading joy, could just leave the sleep mode and get on with the > rest of the code and go for a bigger batttery :) > Andy > ----- Original Message ----- > From: "John Baraclough" > To: "Discussion list for ICCAVR and ICCtiny Users. You do NOT need > tosubscribe to icc-announce if you are a member of this." > > Sent: Thursday, January 03, 2008 6:21 PM > Subject: Re: [Icc-avr] Interrupt Help Please (Happy New Year) >> Almost, but not quite. You need to do something with MCUCR as well. You >> should read paragraph 11.2.3 on page 69 of the data sheet to find out >> more. >> >> John >> >> >> Andrew wrote: >>> Hi >>> >>> How does one tri-state all the inputs? >>> >>> is this correct? >>> >>> PORTD = 0x00; >>> DDRD = 0xFF; >>> >>> Andy >>> >> >> _______________________________________________ >> Icc-avr mailing list >> Icc-avr@imagecraft.com >> http://dragonsgate.net/mailman/listinfo/icc-avr >> > _______________________________________________ > Icc-avr mailing list > Icc-avr@imagecraft.com > http://dragonsgate.net/mailman/listinfo/icc-avr > -- > No virus found in this incoming message. > Checked by AVG Free Edition. > Version: 7.5.516 / Virus Database: 269.17.13/1207 - Release Date: 02.01.08 11:29 From jassenbaum at htp-tel.de Thu Jan 3 14:36:07 2008 From: jassenbaum at htp-tel.de (Johannes Assenbaum) Date: Thu Jan 3 14:50:57 2008 Subject: [Icc-avr] Interrupt Help Please (Happy New Year) References: Message-ID: Would be nice, if you can tell how :-) Johannes > Hi, > i have fixed it :) it now sleeps at 6uA in both conditions :) > Andy > ----- Original Message ----- > From: "Albert vanVeen" > To: "Johannes Assenbaum" ; "Discussion list for > ICCAVR and ICCtiny Users. You do NOT needtosubscribeto icc-announce if you > are a member of this." > Sent: Thursday, January 03, 2008 8:04 PM > Subject: RE: [Icc-avr] Interrupt Help Please (Happy New Year) >> Yes, you're right: writing/reading emails must take as must time as just >> reading the datasheet. >> "Being new" is no excuse for not reading it, it is the ultimate reason. >> When I took over my first AVR project from a colleague 2 years ago, I >> spent most of the first day reading the datasheet to see what the >> characteristics and possibilities are. This is not a waste of time, but >> a good investment! >> >> And: happy new year everyone. >> >> Albert. >> >> >> >> -----Original Message----- >> From: icc-avr-bounces@imagecraft.com >> [mailto:icc-avr-bounces@imagecraft.com] On Behalf Of Johannes Assenbaum >> Sent: Friday, January 04, 2008 07:10 AM >> To: icc-avr@imagecraft.com >> Subject: Re: [Icc-avr] Interrupt Help Please (Happy New Year) >> >> Setting a bit in DDR enables corresponding port pin for output. >> >> So correct io setup for all-inputs i.e. all hi-Z-state is DDRx = 0; >> >> How about reading the datasheet? >> >> Best regards, >> Johannes >> >> >>> Hi >> >>> How does one tri-state all the inputs? >> >>> is this correct? >> >>> PORTD = 0x00; >>> DDRD = 0xFF; >> >>> Andy >> >> >>> ----- Original Message ----- >>> From: "John Baraclough" >>> To: "Discussion list for ICCAVR and ICCtiny Users. You do NOT need >>> tosubscribe to icc-announce if you are a member of this." >>> >>> Sent: Thursday, January 03, 2008 3:37 PM >>> Subject: Re: [Icc-avr] Interrupt Help Please (Happy New Year) >> >> >>>> The processor is clearly in a different state when it goes to sleep >>>> from when it first starts up. At a guess, I would say you are leaving >> >>>> a port pin enabled and driving a low level out to a pull-up resistor >>>> (possibly more than one). Calculating the extra current; 112uA would >>>> be the current drawn through a 47k resistor from a 5V supply (or 30k >> and 3.3V). >>>> >>>> What is the mechanism for turning off the RTC? The ideal way to do >>>> this is to use a resistive pull-up/pull-down to turn off the RTC and >>>> then overdrive it with the appropriate level from a port pin to turn >> it on. >>>> When the processor goes to sleep just tri-state all the port pins so >>>> there is no current drawn. >>>> >>>> HTH >>>> >>>> John >>>> >>>> Andrew wrote: >>>>> Hi john/anybody , >>>>> I have a intresting/anoying problem. to recap. I have an >>>>> AT90USB162. i am basically trying to send the processor to sleep if >>>>> Bit 1 on PORTD is high and wake when the PIN goes low. The basically >> >>>>> tells the processor it has lost main power and is now running on a >> battery. >>>>> I have the code working well and i am getting 7.12uA when the >>>>> Processor is asleep.and my pin interrupt routine works and wakes the >> >>>>> processor if PORTD BIT1 is low and returns back to the 7.12uA when >> PORTD BIT1 is high. >>>>> The problem i have is when i pug the USB in. This also has the same >>>>> effect on PORTD BIT 1 as it now takes over powring the system from >>>>> the battery. >>>>> So as before if the USB connector is pugged in PORDT BIT 1 goes low >> >>>>> and the processor resumes from sleep. this also works and i can use >>>>> the USB port as a serial emulator using some atmel exmaple code. The >> >>>>> probelm comes when i unplug the USB connector. Which sends PORTD BIT >> >>>>> 1 high and thus the processor goes to sleep but it only goes down to >> >>>>> 119uA not the 7.12uA i was getting before. I have checked and the >>>>> processor is asleep as the external oscillator is turnned off. So >>>>> some part of the USB must be still enabled. Can anybody suggest a >>>>> solution: - CODE NOTE : - >>>>> >>>>> #define USB_CONNECTED (PIND & 0x01) >>>>> #define BAT_CONNECTED (PIND & 0x02) >>>>> >>>>> are defined in a sepearte c file. >>>>> >>>>> * * >>>>> >>>>> *void* sleep(*void*); >>>>> *void* wake(*void*); >>>>> >>>>> //------------------------------------------------------------------ >>>>> ----------- >>>>> // >>>>> // Function name : Sleep >>>>> // >>>>> // Returns : None >>>>> // >>>>> // Parameters : None >>>>> // >>>>> // Purpose : Send the processor into sleep mode (Low power) // >>>>> //------------------------------------------------------------------ >>>>> ----------- >>>>> *void* sleep(*void*) >>>>> { >>>>> >>>>> SPCR = 0x00; // Power Down the SPI >>>>> UCSRB = 0x00; // NOT FOUND THIS IN THe DATASHEET >>>>> >>>>> REGCR = 0x01; // Disable the USB Regulator >>>>> RTC_POWER_OFF // Turn the Power too the RTC OFF (PORTD4) >>>>> >>>>> EICRA = 0x08; // Change INT1 Pin Interrupt to Falling >> Edge >>>>> (INT1) >>>>> >>>>> PRR1 = 0x81; // Turn Off the USB and USART using >> the >>>>> power reduction register >>>>> >>>>> SMCR = 0; // Clear SMCR Register >>>>> SMCR = 0x05; // Configure Sleep Register for Deep >> Sleep >>>>> asm(/"sleep"/); // Put Processor into Deep Sleep >>>>> >>>>> } >>>>> >>>>> //------------------------------------------------------------------ >>>>> ----------- >>>>> // >>>>> // Function name : Wake >>>>> // >>>>> // Returns : >>>>> // >>>>> // Parameters : >>>>> // >>>>> // Purpose : Return from Sleep mode and restart devices // >>>>> //------------------------------------------------------------------ >>>>> ----------- >>>>> *void* wake (*void*) >>>>> { >>>>> PRR1 = 0x00; // Restart the USB from Power Reduction >> Mode >>>>> EICRA = 0x0C; // Change the Battery on pin to interrupt >> on >>>>> rising edge (INT1) >>>>> RTC_POWER_ON // Turn the RTC Power Supply back on (PORTD4) >>>>> >>>>> UCSRB = 0x98; // HAVE NO IDEA WHAT THIS REGISTRY IS >> FOR >>>>> SPCR = 0x5C; // Restart the SPI >>>>> Usb_enable_regulator(); // Enable the USB regulator >>>>> } >>>>> >>>>> //------------------------------------------------------------------ >>>>> ----------- >>>>> // Main Program Loop >>>>> //------------------------------------------------------------------ >>>>> ----------- >>>>> *void* main(*void*) >>>>> { >>>>> init_devices(); // Initilise all the devices >>>>> >>>>> Usb_enable_regulator(); // Enable the USB Regulator >>>>> usb_scheduler_init(); // Set up the USB Scheduler >>>>> >>>>> *while* (1) >>>>> { >>>>> >>>>> *if*(USB_CONNECTED) // If the USB Connected Pin is High { >>>>> usb_scheduler_tasks(); // Schedule the USB tasks >>>>> } >>>>> >>>>> *if*(BAT_CONNECTED) // If the Battery Connected Pin is high { >>>>> sleep(); // Call the Sleep function NOP(); // Small Delay NOP(); // >>>>> Small Delay wake(); // Wake from Sleep and restart USB and SPI >>>>> >>>>> } >>>>> >>>>> } >>>>> } >>>>> >>>>> Andy >>>>> -------------------------------------------------------------------- >>>>> ---- >>>>> >>>>> _______________________________________________ >>>>> Icc-avr mailing list >>>>> Icc-avr@imagecraft.com >>>>> http://dragonsgate.net/mailman/listinfo/icc-avr >>>>> >>>> >>>> _______________________________________________ >>>> Icc-avr mailing list >>>> Icc-avr@imagecraft.com >>>> http://dragonsgate.net/mailman/listinfo/icc-avr >>>> >> >>> _______________________________________________ >>> Icc-avr mailing list >>> Icc-avr@imagecraft.com >>> http://dragonsgate.net/mailman/listinfo/icc-avr >> >> >>> -- >>> No virus found in this incoming message. >>> Checked by AVG Free Edition. >>> Version: 7.5.516 / Virus Database: 269.17.13/1207 - Release Date: >>> 02.01.08 11:29 >> >> >> _______________________________________________ >> Icc-avr mailing list >> Icc-avr@imagecraft.com >> http://dragonsgate.net/mailman/listinfo/icc-avr >> >> Scanned by Bizo Email Filter >> >> >> _______________________________________________ >> Icc-avr mailing list >> Icc-avr@imagecraft.com >> http://dragonsgate.net/mailman/listinfo/icc-avr >> > _______________________________________________ > Icc-avr mailing list > Icc-avr@imagecraft.com > http://dragonsgate.net/mailman/listinfo/icc-avr > -- > No virus found in this incoming message. > Checked by AVG Free Edition. > Version: 7.5.516 / Virus Database: 269.17.13/1207 - Release Date: 02.01.08 11:29 From andrew_166 at msn.com Thu Jan 3 15:12:18 2008 From: andrew_166 at msn.com (Andrew) Date: Thu Jan 3 15:26:53 2008 Subject: [Icc-avr] Interrupt Help Please (Happy New Year) References: Message-ID: Hi Johannes, To Quote Albert " Yes, you're right: writing/reading emails must take as must time as just reading the datasheet. "Being new" is no excuse for not reading it, it is the ultimate reason."" So my answer would be READ THE DATASHEET (1-300pgs) you will soon find it for yourself. But then if everybody was like that there would be no point in mailing list's and user forums would there? Anyway i like sharing ideas and helping where i can so onto the solution: - Basically the soloution was quit simple i had forgotten all about the PPL USB clock generator mentioned at the very begining of the Datasheet (AKA PLLCSR register). Intrestingly there is nothing menthioned about it in the power managment of both the chip and or the USB.Put it turns out it must be turnnes off before sleep mode is entered and enabled again on waking.here is the code i used: - void sleep(void) { DDRB = 0x00; // Tri-State PORTB DDRC = 0x00; // Tri-State PORTC DDRD = 0x00; // Tri-State PORTD PORTB = 0x00; // Make Sure the port is not pulled-up PORTC = 0x00; // Make Sure the port is not pulled-up PORTD = 0x00; // Make Sure the port is not pulled-up SPCR = 0x00; // Power Down the SPI UCSRB = 0x00; // Power Down The USART TCCR1B = 0x00; // Stop timer TIMSK1 = 0x00; // Disable Timer Intterupts REGCR = 0x01; // Disable the USB Regulator just to make sure EICRA = 0x08; // Change INT1 Pin Interrupt to Falling Edge (INT1) PLLCSR = 0x01; // PRR1 = 0x81; // Turn Off the USB and USART using the power reduction register SMCR = 0; // Clear SMCR Register SMCR = 0x05; // Configure Sleep Register for Deep Sleep asm("sleep"); // Put Processor into Deep Sleep } void wake (void) { PLLCSR = 0x03; PRR1 &= ~ 0x81; // Restart the USB from Power Reduction Mode EICRA = 0x0C; // Change the Battery on pin to interrupt on rising edge (INT1) RTC_POWER_ON // Turn the RTC Power Supply back on (PORTD4) UCSRB = 0x98; // ?????????????????? init_devices(); } This gives 6uA in both condistions. And according to the datasheet this is about correct. I will test again when i get into work with the calibrated/more accurate multimeter. NOTE PAGE 37 has all the information regarding the PPL register. Thanks for all your help and suggestions, Andy ----- Original Message ----- From: "Johannes Assenbaum" To: Sent: Thursday, January 03, 2008 10:36 PM Subject: Re: [Icc-avr] Interrupt Help Please (Happy New Year) > Would be nice, if you can tell how :-) > > Johannes > >> Hi, > >> i have fixed it :) it now sleeps at 6uA in both conditions :) > >> Andy > >> ----- Original Message ----- >> From: "Albert vanVeen" >> To: "Johannes Assenbaum" ; "Discussion list for >> ICCAVR and ICCtiny Users. You do NOT needtosubscribeto icc-announce if >> you >> are a member of this." >> Sent: Thursday, January 03, 2008 8:04 PM >> Subject: RE: [Icc-avr] Interrupt Help Please (Happy New Year) > > >>> Yes, you're right: writing/reading emails must take as must time as just >>> reading the datasheet. >>> "Being new" is no excuse for not reading it, it is the ultimate reason. >>> When I took over my first AVR project from a colleague 2 years ago, I >>> spent most of the first day reading the datasheet to see what the >>> characteristics and possibilities are. This is not a waste of time, but >>> a good investment! >>> >>> And: happy new year everyone. >>> >>> Albert. >>> >>> >>> >>> -----Original Message----- >>> From: icc-avr-bounces@imagecraft.com >>> [mailto:icc-avr-bounces@imagecraft.com] On Behalf Of Johannes Assenbaum >>> Sent: Friday, January 04, 2008 07:10 AM >>> To: icc-avr@imagecraft.com >>> Subject: Re: [Icc-avr] Interrupt Help Please (Happy New Year) >>> >>> Setting a bit in DDR enables corresponding port pin for output. >>> >>> So correct io setup for all-inputs i.e. all hi-Z-state is DDRx = 0; >>> >>> How about reading the datasheet? >>> >>> Best regards, >>> Johannes >>> >>> >>>> Hi >>> >>>> How does one tri-state all the inputs? >>> >>>> is this correct? >>> >>>> PORTD = 0x00; >>>> DDRD = 0xFF; >>> >>>> Andy >>> >>> >>>> ----- Original Message ----- >>>> From: "John Baraclough" >>>> To: "Discussion list for ICCAVR and ICCtiny Users. You do NOT need >>>> tosubscribe to icc-announce if you are a member of this." >>>> >>>> Sent: Thursday, January 03, 2008 3:37 PM >>>> Subject: Re: [Icc-avr] Interrupt Help Please (Happy New Year) >>> >>> >>>>> The processor is clearly in a different state when it goes to sleep >>>>> from when it first starts up. At a guess, I would say you are leaving >>> >>>>> a port pin enabled and driving a low level out to a pull-up resistor >>>>> (possibly more than one). Calculating the extra current; 112uA would >>>>> be the current drawn through a 47k resistor from a 5V supply (or 30k >>> and 3.3V). >>>>> >>>>> What is the mechanism for turning off the RTC? The ideal way to do >>>>> this is to use a resistive pull-up/pull-down to turn off the RTC and >>>>> then overdrive it with the appropriate level from a port pin to turn >>> it on. >>>>> When the processor goes to sleep just tri-state all the port pins so >>>>> there is no current drawn. >>>>> >>>>> HTH >>>>> >>>>> John >>>>> >>>>> Andrew wrote: >>>>>> Hi john/anybody , >>>>>> I have a intresting/anoying problem. to recap. I have an >>>>>> AT90USB162. i am basically trying to send the processor to sleep if >>>>>> Bit 1 on PORTD is high and wake when the PIN goes low. The basically >>> >>>>>> tells the processor it has lost main power and is now running on a >>> battery. >>>>>> I have the code working well and i am getting 7.12uA when the >>>>>> Processor is asleep.and my pin interrupt routine works and wakes the >>> >>>>>> processor if PORTD BIT1 is low and returns back to the 7.12uA when >>> PORTD BIT1 is high. >>>>>> The problem i have is when i pug the USB in. This also has the same >>>>>> effect on PORTD BIT 1 as it now takes over powring the system from >>>>>> the battery. >>>>>> So as before if the USB connector is pugged in PORDT BIT 1 goes low >>> >>>>>> and the processor resumes from sleep. this also works and i can use >>>>>> the USB port as a serial emulator using some atmel exmaple code. The >>> >>>>>> probelm comes when i unplug the USB connector. Which sends PORTD BIT >>> >>>>>> 1 high and thus the processor goes to sleep but it only goes down to >>> >>>>>> 119uA not the 7.12uA i was getting before. I have checked and the >>>>>> processor is asleep as the external oscillator is turnned off. So >>>>>> some part of the USB must be still enabled. Can anybody suggest a >>>>>> solution: - CODE NOTE : - >>>>>> >>>>>> #define USB_CONNECTED (PIND & 0x01) >>>>>> #define BAT_CONNECTED (PIND & 0x02) >>>>>> >>>>>> are defined in a sepearte c file. >>>>>> >>>>>> * * >>>>>> >>>>>> *void* sleep(*void*); >>>>>> *void* wake(*void*); >>>>>> >>>>>> //------------------------------------------------------------------ >>>>>> ----------- >>>>>> // >>>>>> // Function name : Sleep >>>>>> // >>>>>> // Returns : None >>>>>> // >>>>>> // Parameters : None >>>>>> // >>>>>> // Purpose : Send the processor into sleep mode (Low power) // >>>>>> //------------------------------------------------------------------ >>>>>> ----------- >>>>>> *void* sleep(*void*) >>>>>> { >>>>>> >>>>>> SPCR = 0x00; // Power Down the SPI >>>>>> UCSRB = 0x00; // NOT FOUND THIS IN THe DATASHEET >>>>>> >>>>>> REGCR = 0x01; // Disable the USB Regulator >>>>>> RTC_POWER_OFF // Turn the Power too the RTC OFF (PORTD4) >>>>>> >>>>>> EICRA = 0x08; // Change INT1 Pin Interrupt to Falling >>> Edge >>>>>> (INT1) >>>>>> >>>>>> PRR1 = 0x81; // Turn Off the USB and USART using >>> the >>>>>> power reduction register >>>>>> >>>>>> SMCR = 0; // Clear SMCR Register >>>>>> SMCR = 0x05; // Configure Sleep Register for Deep >>> Sleep >>>>>> asm(/"sleep"/); // Put Processor into Deep Sleep >>>>>> >>>>>> } >>>>>> >>>>>> //------------------------------------------------------------------ >>>>>> ----------- >>>>>> // >>>>>> // Function name : Wake >>>>>> // >>>>>> // Returns : >>>>>> // >>>>>> // Parameters : >>>>>> // >>>>>> // Purpose : Return from Sleep mode and restart devices // >>>>>> //------------------------------------------------------------------ >>>>>> ----------- >>>>>> *void* wake (*void*) >>>>>> { >>>>>> PRR1 = 0x00; // Restart the USB from Power Reduction >>> Mode >>>>>> EICRA = 0x0C; // Change the Battery on pin to interrupt >>> on >>>>>> rising edge (INT1) >>>>>> RTC_POWER_ON // Turn the RTC Power Supply back on (PORTD4) >>>>>> >>>>>> UCSRB = 0x98; // HAVE NO IDEA WHAT THIS REGISTRY IS >>> FOR >>>>>> SPCR = 0x5C; // Restart the SPI >>>>>> Usb_enable_regulator(); // Enable the USB regulator >>>>>> } >>>>>> >>>>>> //------------------------------------------------------------------ >>>>>> ----------- >>>>>> // Main Program Loop >>>>>> //------------------------------------------------------------------ >>>>>> ----------- >>>>>> *void* main(*void*) >>>>>> { >>>>>> init_devices(); // Initilise all the devices >>>>>> >>>>>> Usb_enable_regulator(); // Enable the USB Regulator >>>>>> usb_scheduler_init(); // Set up the USB Scheduler >>>>>> >>>>>> *while* (1) >>>>>> { >>>>>> >>>>>> *if*(USB_CONNECTED) // If the USB Connected Pin is High { >>>>>> usb_scheduler_tasks(); // Schedule the USB tasks >>>>>> } >>>>>> >>>>>> *if*(BAT_CONNECTED) // If the Battery Connected Pin is high { >>>>>> sleep(); // Call the Sleep function NOP(); // Small Delay NOP(); // >>>>>> Small Delay wake(); // Wake from Sleep and restart USB and SPI >>>>>> >>>>>> } >>>>>> >>>>>> } >>>>>> } >>>>>> >>>>>> Andy >>>>>> -------------------------------------------------------------------- >>>>>> ---- >>>>>> >>>>>> _______________________________________________ >>>>>> Icc-avr mailing list >>>>>> Icc-avr@imagecraft.com >>>>>> http://dragonsgate.net/mailman/listinfo/icc-avr >>>>>> >>>>> >>>>> _______________________________________________ >>>>> Icc-avr mailing list >>>>> Icc-avr@imagecraft.com >>>>> http://dragonsgate.net/mailman/listinfo/icc-avr >>>>> >>> >>>> _______________________________________________ >>>> Icc-avr mailing list >>>> Icc-avr@imagecraft.com >>>> http://dragonsgate.net/mailman/listinfo/icc-avr >>> >>> >>>> -- >>>> No virus found in this incoming message. >>>> Checked by AVG Free Edition. >>>> Version: 7.5.516 / Virus Database: 269.17.13/1207 - Release Date: >>>> 02.01.08 11:29 >>> >>> >>> _______________________________________________ >>> Icc-avr mailing list >>> Icc-avr@imagecraft.com >>> http://dragonsgate.net/mailman/listinfo/icc-avr >>> >>> Scanned by Bizo Email Filter >>> >>> >>> _______________________________________________ >>> Icc-avr mailing list >>> Icc-avr@imagecraft.com >>> http://dragonsgate.net/mailman/listinfo/icc-avr >>> > >> _______________________________________________ >> Icc-avr mailing list >> Icc-avr@imagecraft.com >> http://dragonsgate.net/mailman/listinfo/icc-avr > > >> -- >> No virus found in this incoming message. >> Checked by AVG Free Edition. >> Version: 7.5.516 / Virus Database: 269.17.13/1207 - Release Date: >> 02.01.08 11:29 > > > _______________________________________________ > Icc-avr mailing list > Icc-avr@imagecraft.com > http://dragonsgate.net/mailman/listinfo/icc-avr > From j_baraclough at zetnet.co.uk Thu Jan 3 15:17:23 2008 From: j_baraclough at zetnet.co.uk (John Baraclough) Date: Thu Jan 3 15:31:41 2008 Subject: [Icc-avr] Interrupt Help Please (Happy New Year) In-Reply-To: References: Message-ID: <477D6D03.9050806@zetnet.co.uk> You stole the words out of my mouth. John P.S. I'm not even sure that my cheapo digital multimeter will measure current that low. :-[ Johannes Assenbaum wrote: > Would be nice, if you can tell how :-) > > Johannes > > >> Hi, >> > > >> i have fixed it :) it now sleeps at 6uA in both conditions :) >> > > >> Andy >> From mark at extron.com.au Thu Jan 3 17:04:34 2008 From: mark at extron.com.au (Mark Barber) Date: Thu Jan 3 17:19:17 2008 Subject: [Icc-avr] V7 Licence Key In-Reply-To: <477D2D9E.9060802@zetnet.co.uk> References: <477D2D9E.9060802@zetnet.co.uk> Message-ID: <03f001c84e6d$ce228630$6801a8c0@mark> Buy the USB hardware dongle I use it and it is very easy to transfer from one to the other. Mark ********************************** Mark Barber Extron Technologies Pty. Ltd. www.extron.com.au Ph: 613-9761-8166 Fx: 613-9761-8177 **********************************? ? -----Original Message----- From: icc-avr-bounces@imagecraft.com [mailto:icc-avr-bounces@imagecraft.com] On Behalf Of John Baraclough Sent: Friday, 4 January 2008 5:47 AM To: Discussion list for ICCAVR and ICCtiny Users. You do NOT need tosubscribe to icc-announce if you are a member of this. Subject: Re: [Icc-avr] V7 Licence Key From the help file: *Using the Product on Multiple Computers If you need to use the product on multiple computers, such as on an office PC and a laptop, and if you are the only user of the product, you may obtain a separate license from us. Contact us for details. Alternatively, you may purchase the hardware dongle. * HTH John Andy Syms wrote: > How do I transfer the licence key between computers on version 7? There's > no transfer to floppy command that I can see. > > -- > >>> Andy Syms Technosoft Systems Ltd >>> _______________________________________________ Icc-avr mailing list Icc-avr@imagecraft.com http://dragonsgate.net/mailman/listinfo/icc-avr From scottk at skelleyco.com Thu Jan 3 17:51:34 2008 From: scottk at skelleyco.com (Scott) Date: Thu Jan 3 18:06:56 2008 Subject: [Icc-avr] Is there something wrong with this RTC interrupt? In-Reply-To: <45C877F1.5060108@agh.edu.pl> References: <45C877F1.5060108@agh.edu.pl> Message-ID: <007401c84e74$56199870$0500a8c0@FIFI2> My RTC is running slow. I have a number of devices that are running this code, and all of them are losing somewhere around 3 or 4 minutes per month. Looking at my code, it seems that I must be missing ticks while the isr is running. If I did my math right, it seems like I must be missing 3 or 4 ticks per second. If this is right, I think what I need to do is to init the timer as a countdown, with a preset value equal to 32,768 min