first off
can_disable was designed to work with at90can seriers so might not work
with your uC
Other than the timer, I'm not sure what canfestival can do to wake the
controller up, but i have zero experience with sleep, so keep that in mind.
Before sleep I think it is best to set the node in stop mode. It just
disable processing and making of almost every type of canopen message, and
it will also tell the network that is has stopped.
On start, what you have done looks good to me.
best regards
Lars
On Wed, 19 Dec 2018, 19:41 Basically my question is what to do before to go in sleep mode and what to
> do just after the wake up.
>
> In the main I do:
>
> switch(baudrate) // 0=100KBaud, 1=125KBaud, 2=200KBaud, 3=250KBaud,
> 4=500KBaud, 5=1000KBaud
> {
> case 0: canInit(100); break;
> case 1: canInit(125); break;
> case 2: canInit(200); break;
> case 3: canInit(250); break;
> case 4: canInit(500); break;
> case 5: canInit(1000); break;
> }
> initTimer(); // Start timer for the CANopen
> stack
> setNodeId(_Data, nodeID);
> setState(_Data, Pre_operational); // Init the state
>
> so, shall I have to do something before the sleep?
>
> and after at the wake up?
>
> Thanks in advance to anyone spends time in this.
>
>
>
> Messaggio originale
> Da: canfestival-devel@lists.sourceforge.net
> Data: 19-dic-2018 18.52
> A:
> Ogg: [Canfestival-devel] R: R: R: R: Re: R: Re: R: Re: R: Re: R: R: R: R:
> R: R: R: R: R: Re: R: Re: R: Re: CanFestival on ATmega64M1 in Arduino IDE
>
>
> Another question:
>
> I've implemented the canFestival on a node which goes in sleep mode
> (POWER_DOWN) when there's no power supply.
>
> This device has a battery to keep the power supply on in OR with the main
> one.
>
> Of course when the battery is on I need to put everything in deep sleep
> mode with a consumption around 1.5uA @3V.
>
> The issue is that sometimes, if I receive something on the bus, the node
> suddendly wakes up from the sleep.
>
> Therefore I need to avoid this bad situation in order to avoid the battery
> discharge.
>
> How can I disable the canbus just before to go in sleep?
>
> Basically the sleep mode control is made in pin_change interrupt function.
>
> ISR(PCINT1_vect) // interrupt service routine called when the sensor
> is battery powered or not (LOWER PRIORITY THAN PCINT0_vect)
> {
> sleepMode = !digitalRead(V_supply);
>
> if ( sleepMode )
> {
> Can_disable(); // doesn't work
>
> #ifdef SERIAL_DEBUG
> Serial.print('\0'); // print the NULL character to be sure that
> the TX port pin (PB0) is LOW
> #endif
> cli();
> stopADC();
> sleep();
> }
> else
> turnedOn = true;
> }
>
>
> I'm quite sure that there is something in the canFestival framework which
> put the uC ON if something is received just before to go in sleep.
>
> Any suggestion?
>
> ----Messaggio originale
> Da: canfestival-devel@lists.sourceforge.net
> Data: 18-dic-2018 10.24
> A:
> Ogg: [Canfestival-devel] R: R: R: Re: R: Re: R: Re: R: Re: R: R: R: R: R:
> R: R: R: R: Re: R: Re: R: Re: CanFestival on ATmega64M1 in Arduino IDE
>
> Sorry guys my fault.
>
> The default nodeID is 0x01.
>
> Everything works correctly
>
> Thanks and sorry
>
>
> Messaggio originale
> Da: canfestival-devel@lists.sourceforge.net
> Data: 18-dic-2018 10.17
> A:
> Ogg: [Canfestival-devel] R: R: Re: R: Re: R: Re: R: Re: R: R: R: R: R: R:
> R: R: R: Re: R: Re: R: Re: CanFestival on ATmega64M1 in Arduino IDE
>
> I've found the issue.
>
> It relative on how the objectdictionary .c file is created.
>
> If I leave the file as it is
>
> /* index 0x1200 : Server SDO Parameter. */
> UNS8 ObjDict_highestSubIndex_obj1200 = 2; /* number of
> subindex - 1*/
> UNS32
> ObjDict_obj1200_COB_ID_Client_to_Server_Receive_SDO = 0x600;/* 1536 */
>
> The canbus node doesn't reply to any SDO request.
>
> If I change it like this
>
> /* index 0x1200 : Server SDO Parameter. */
> UNS8 ObjDict_highestSubIndex_obj1200 = 2; /* number of
> subindex - 1*/
> UNS32
> ObjDict_obj1200_COB_ID_Client_to_Server_Receive_SDO = 0x605; /* 1536 */
>
> where 0x05 is the nodeID
>
> I get the right reply from my node
>
> Is this a bug on the object dictionary building procedure in the python
> script?
>
> Waiting a kind reply
>
> Thanks
>
> Messaggio originale
> Da: canfestival-devel@lists.sourceforge.net
> Data: 17-dic-2018 20.16
> A:
> Ogg: [Can