if I debug the ISR(CAN_INT_vect) I can see the full activity during the PDO 
transmission, and a hole waiting for the next PDO timing.
How can I know when the PDO is transmitted?
In order to put the uC in sleep when the canbus is waiting for the next PDO to 
be transmitted.
Thanks




  ----Messaggio originale----
 
 Da: canfestival-devel@lists.sourceforge.net
 
 Data: 24-dic-2018 12.13
 
 A: <canfestival-devel@lists.sourceforge.net>
 
 Ogg: [Canfestival-devel] R: Re: R: R: Re: R: 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
 

 

 
  

 
 
  This is a serious problem/bug. 
  

 
 
  Sometime, if I remove the main power supply and the uC try to go in sleep 
mode (power_down) happens that it is trapped inside the CAN interrupt 
(ISR(CAN_INT_vect)).
 
 
  

 
 
  The issue is that I cannot clear the CANIT General Interrupt Flag because it 
is a read only bit.
 
 
  

 
 
  What to you suggest to do in order to avoid that the uC stays trapped in the 
CAN_INT_vect?
 
 
  

 
 
  Thanks in advance
  

 
 

 
   ----Messaggio originale---- 
  
 Da: canfestival-devel@lists.sourceforge.net 
  
 Data: 22-dic-2018 10.01 
  
 A: <canfestival-devel@lists.sourceforge.net> 
  
 Ogg: Re: [Canfestival-devel] R: R: Re: R: 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 
  

  

  
    is it possible to mask out interrupts to limit the number of interrupts 
that makes it wake up? 
   
     just for debugging 
   
  
  

  
   
     On Fri, 21 Dec 2018, 21:02 < 
    canfestival-devel@lists.sourceforge.net wrote: 
    

   
   
    
      Hi guys, 
    
    
     

    
    
      I'm getting crazy on why I'm not able to go in sleep using the 
canFestival stack. 
    
    
     

    
    
      Using the ISR(PCINT1_vect) sometime if I remove the power supply while 
the canbus is working the uC goes in a strange situation. 
    
    
     

    
    
      Not in sleep but not in run as well. Anyway the power consumption is like 
in run. 
    
    
     

    
    
      Basically, I'm using a pin to debug the situation 
    
    
          DDRD |= (1<<PD2);      // set PD2 as output DEBUG 
     
    PORTD &amp;= ~(1<<PD2);       // set LOW state DEBUG 
    
    
      but sometime happen that the uC try to goes in sleep but suddenly it 
comes back in "run" 
     

    
    
     

    
    
     

    
    
      ----Messaggio originale---- 
     
 Da: 
     canfestival-devel@lists.sourceforge.net
     
 Data: 20-dic-2018 17.10 
     
 A: < 
     canfestival-devel@lists.sourceforge.net> 
     
 Ogg: [Canfestival-devel] R: Re: R: 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 
     

     

     
       >>> can_disable was designed to work with at90can seriers so might not 
work with your uC 
     
     
       looking the datasheet of ATmega64M1 the can register is the same. By the 
way the can_drv.h is rewritten for my uC. 
     
     
      

     
     
      
        >>> 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. 
       

      
      
        Already tried to put the node in stop mode. It doesn't work. What seems 
to happen is that the uC seems to miss the interrupt because it has a lower 
priority with can interrupts. 
      
      
       

      
      
        Now I'm doing other tests to solve this issue. 
      
      
       

      
      
        thanks anyway 
       

      
     
     

     
       ----Messaggio originale---- 
      
 Da: 
      canfestival-devel@lists.sourceforge.net
      
 Data: 20-dic-2018 16.54 
      
 A: < 
      canfestival-devel@lists.sourceforge.net> 
      
 Ogg: Re: [Canfestival-devel] R: 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 
      

      

      
       
         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 < 
          canfestival-devel@lists.sourceforge.net wrote: 
          

         
         
          
            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(&amp;ObjDict_Data, nodeID); 
           
  setState(&amp;ObjDict_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: < 
           canfestival-devel@lists.sourceforge.net> 
           
 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: < 
            canfestival-devel@lists.sourceforge.net> 
            
 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: < 
             canfestival-devel@lists.sourceforge.net> 
             
 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: < 
              canfestival-devel@lists.sourceforge.net> 
              
 Ogg: [Canfestival-devel] 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 did some other tests. 
              
              
               

              
              
                The issue seems inside the canDispatch function in states.c. 
              
              
               

              
              
                I'm using a pin as debug in order to understand if the code in 
some point is executed or not. 
              
              
               

              
              
                basically this is done in the canDispatch: 
              
              
               

              
              
                .............. 
               

              
              
                        case SDOrx: 
               
            if (d->CurrentCommunicationState.csSDO) 
               
                        { 
               
                    DDRB |= (1<<PB4);      // set PB4 as output 
               
                    PORTB |= (1<<PB4);     // set PB4 HIGH for DEBUG 
               
                proceedSDO(d,m); 
               
                        } 
               
            break; 
               
        case NODE_GUARD: 
               
            if (d->CurrentCommunicationState.csLifeGuard) 
               
                proceedNODE_GUARD(d,m); 
               
            break; 
               
        case NMT: 
               
            if (*(d->iam_a_slave)) 
               
                        { 
               
                    DDRB |= (1<<PB4);      // set PB4 as output 
               
                    PORTB |= (1<<PB4);     // set PB4 HIGH for DEBUG 
               
                proceedNMTstateChange(d,m); 
               
                        } 
               
            break; 
               

              
              
                ............ 
              
              
               

              
              
                I can see that at the beginning, when I change the state from 
initialization to oeprational the case NMT is executed correctly. 
               

              
              
                In fact I see the right PDO coming down to the bus. 
              
              
               

              
              
                But if I send a message on the bus, the case SDOrx is not 
executed, then neither the proceedSDO(d,m) function 
              
              
               

              
              
                I'll investigate well tomorrow yet. 
              
              
               

              
              
               

              
              
                ----Messaggio originale---- 
               
 Da: 
               canfestival-devel@lists.sourceforge.net
               
 Data: 17-dic-2018 0.00 
               
 A: < 
               canfestival-devel@lists.sourceforge.net> 
               
 Ogg: Re: [Canfestival-devel] 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 
               

               

               
                 symboles.c: dont know if it does any damage, but it does 
nothing good. 
                
                  it's for Linux kernel module usage you should not include it 
in Arduino build 
                
               
               

               
                
                  On Sat, 15 Dec 2018, 17:33 < 
                 canfestival-devel@lists.sourceforge.net wrote: 
                 

                
                
                 
                   Could this issue during compilation 
                 
                 
                  

                 
                 
                   
/home/alessio/Arduino/libraries/CanFestival_ATmega64M1_Arduino/symbols.c:56:1: 
warning: type defaults to 'int' in declaration of 'EXPORT_SYMBOL' [enabled by 
default] 
                  
/home/alessio/Arduino/libraries/CanFestival_ATmega64M1_Arduino/symbols.c:56:1: 
warning: parameter names (without types) in function declaration [enabled by 
default] 
                  
/home/alessio/Arduino/libraries/CanFestival_ATmega64M1_Arduino/symbols.c:57:1: 
warning: data definition has no type or storage class [enabled by default] 
                  
 EXPORT_SYMBOL (_setODentry); 
                  
 ^ 
                 
                 
                  

                 
                 
                   be an issue regarding the missing replies on the BUS. 
                 
                 
                  

                 
                 
                   This kind of warning message is repeated for many symbols: 
                 
                 
                  

                 
                 
                   honestly I don't think so but for completeness I give you 
this information 
                 
                 
                  

                 
                 
                   Thanks 
                  

                 
                 

                 
                   ----Messaggio originale---- 
                  
Da: 
                  canfestival-devel@lists.sourceforge.net
                  
Data: 13-dic-2018 21.02 
                  
A: < 
                  canfestival-devel@lists.sourceforge.net> 
                  
Ogg: Re: [Canfestival-devel] R: Re: R: Re: R: R: R: R: R: R: R: R: R: Re: R: 
Re: R: Re: CanFestival on ATmega64M1 in Arduino IDE 
                  

                  
Do the can messages look okay in the canDispatch function (states.c) 
                  
On Thu, Dec 13, 2018 at 7:30 PM < 
                  canfestival-devel@lists.sourceforge.net> wrote: 
                  
> 
                  
> That's the strange thing. 
                  
> 
                  
> The node doesn't react to any message sent 
                  
> 
                  
> ----Messaggio originale---- 
                  
> Da: 
                  canfestival-devel@lists.sourceforge.net
                  
> Data: 13-dic-2018 18.04 
                  
> A: < 
                  canfestival-devel@lists.sourceforge.net> 
                  
> Ogg: Re: [Canfestival-devel] R: Re: R: R: R: R: R: R: R: R: R: Re: R: Re: R: 
> Re: CanFestival on ATmega64M1 in Arduino IDE 
                  
> 
                  
> Strange, 
                  
> You should get a reply on "all" sdo messages 
                  
> Does the node react to any messages you send to the node? 
                  
> 
                  
> 
                  
> 
                  
> 
                  
> 
                  
> 
                  
> On Thu, Dec 13, 2018 at 10:57 AM 
                  
> < 
                  canfestival-devel@lists.sourceforge.net> wrote: 
                  
> > 
                  
> > PDOs every 100ms are running correctly. 
                  
> > 
                  
> > The issue remaining is the response from the node. 
                  
> > 
                  
> > For instance if I wish to change the event cycle for the PDO from 100ms to 
> > 70 ms I need to write on the bus: 
                  
> > 
                  
> > nodeID  2Bh 00h 18h 05h 46h 00h 00h 00h 
                  
> > 
                  
> >  where nodeID is 600+ID and in my case is 601 
                  
> > 
                  
> > Normally when you send something on the canbus you get a response from the 
> > node that depends if the object dictionary element is implemented in the 
> > dictionary. 
                  
> > 
                  
> > In my case I don't get any reply from the node. 
                  
> > 
                  
> > I don't know why 
                  
> > 
                  
> > 
                  
> > ----Messaggio originale---- 
                  
> > Da: 
                  canfestival-devel@lists.sourceforge.net
                  
> > Data: 13-dic-2018 10.07 
                  
> > A: < 
                  canfestival-devel@lists.sourceforge.net> 
                  
> > Ogg: Re: [Canfestival-devel] R: R: R: R: R: R: R: R: R: Re: R: Re: R: Re: 
> > CanFestival on ATmega64M1 in Arduino IDE 
                  
> > 
                  
> > so, everything is up and running? 
                  
> > 
                  
> > On Wed, 12 Dec 2018, 16:17 < 
                  canfestival-devel@lists.sourceforge.net wrote: 
                  
> >> 
                  
> >> Ok, 
                  
> >> 
                  
> >> solved with 
                  
> >> 
                  
> >>   // CANIE1 = 0x7F;    // Enable the interrupts of all MObs (0..14) 
                  
> >>   // CANIE2 = 0xFF; 
                  
> >>   CANIE2 = 0x3F;    // Enable the interrupts of all MObs (0..5) edited for 
> >> ATmegaxxM1 
                  
> >> 
                  
> >> in the can_AVR.c file 
                  
> >> 
                  
> >> ----Messaggio originale---- 
                  
> >> Da: 
                  canfestival-devel@lists.sourceforge.net
                  
> >> Data: 12-dic-2018 11.49 
                  
> >> A: < 
                  canfestival-devel@lists.sourceforge.net> 
                  
> >> Ogg: [Canfestival-devel] R: R: R: R: R: R: R: R: Re: R: Re: R: Re: 
> >> CanFestival on ATmega64M1 in Arduino IDE 
                  
> >> 
                  
> >> 
                  
> >> the Atmega64M1 has only 6 Mobs instead of 15 of AT90CAN128. 
                  
> >> 
                  
> >> So I need to change some #define in the can_drv.h file 
                  
> >> 
                  
> >> // #define NB_MOB       15 
                  
> >> #define NB_MOB       6 // edited for ATmegaxxM1 
                  
> >> #define NB_DATA_MAX  8 
                  
> >> #define LAST_MOB_NB  (NB_MOB-1) 
                  
> >> #define NO_MOB       0xFF 
                  
> >>     // ---------- 
                  
> >> //typedef enum { 
                  
> >> //        MOB_0,  MOB_1, MOB_2,  MOB_3,  MOB_4,  MOB_5,  MOB_6, MOB_7, 
                  
> >> //        MOB_8,  MOB_9, MOB_10, MOB_11, MOB_12, MOB_13, MOB_14        } 
> >> can_mob_t; 
                  
> >> typedef enum {MOB_0,  MOB_1, MOB_2,  MOB_3,  MOB_4,  MOB_5} can_mob_t;// 
> >> edited for ATmegaxxM1 
                  
> >> 
                  
> >> 
                  
> >> 
                  
> >> ----Messaggio originale---- 
                  
> >> Da: 
                  canfestival-devel@lists.sourceforge.net
                  
> >> Data: 12-dic-2018 11.33 
                  
> >> A: < 
                  canfestival-devel@lists.sourceforge.net> 
                  
> >> Ogg: [Canfestival-devel] R: R: R: R: R: R: R: Re: R: Re: R: Re: 
> >> CanFestival on ATmega64M1 in Arduino IDE 
                  
> >> 
                  
> >> Sorry my mistake, 
                  
> >> 
                  
> >> the number of PDO sent after the operational mode is, of course, equal to 
> >> NB_TX_MOB = (NB_MOB - NB_RX_MOB) 
                  
> >> 
                  
> >> ----Messaggio originale---- 
                  
> >> Da: 
                  canfestival-devel@lists.sourceforge.net
                  
> >> Data: 12-dic-2018 10.58 
                  
> >> A: < 
                  canfestival-devel@lists.sourceforge.net> 
                  
> >> Ogg: [Canfestival-devel] R: R: R: R: R: R: Re: R: Re: R: Re: CanFestival 
> >> on ATmega64M1 in Arduino IDE 
                  
> >> 
                  
> >> Hi, 
                  
> >> after some proofs I found another issue on the ATmega64M1. 
                  
> >> 
                  
> >> Basically and actually I'm able to receive only some PDOs at the beginning 
> >> (after the operational mode). 
                  
> >> The number of PDOs receive is based on the NB_RX_MOB define. 
                  
> >> So if I define NB_RX_MOB = 3 I receive only 3 PDO after the operational 
> >> mode, if I define it = 6 I receive only 6 PDOs. 
                  
> >> 
                  
> >> After that the canbus goes in a sort of stuck mode and I need a master 
> >> reset to resume the node. 
                  
> >> 
                  
> >> The timer1 works properly just adding these instructions: 
                  
> >> 
                  
> >>   /* Added by me for Arduino compliance */ 
                  
> >>   TCCR1A = 0; 
                  
> >>   TCCR1B = 0; 
                  
> >>   TIMSK1 = 0; 
                  
> >>   /**************************************/ 
                  
> >> 
                  
> >> in the timer_AVR.c 
                  
> >> 
                  
> >> Any suggestion? 
                  
> >> 
                  
> >> Thanks in advance 
                  
> >> 
                  
> >> ----Messaggio originale---- 
                  
> >> Da: 
                  canfestival-devel@lists.sourceforge.net
                  
> >> Data: 11-dic-2018 16.01 
                  
> >> A: < 
                  canfestival-devel@lists.sourceforge.net> 
                  
> >> Ogg: [Canfestival-devel] R: R: R: R: R: Re: R: Re: R: Re: CanFestival on 
> >> ATmega64M1 in Arduino IDE 
                  
> >> 
                  
> >> I've found the issue and it was relative to the TCCR1A value. 
                  
> >> 
                  
> >> Arduino touches this timer at the beginning in the wiring.c file. 
                  
> >> 
                  
> >> Then actually the timer works but I can receive only five PDO after the 
> >> startup. 
                  
> >> 
                  
> >> After that the CANBUS seems stuck and I don't receive PDO anymore. 
                  
> >> 
                  
> >> The only way is to make a master reset in order to receive other 5 PDO. 
                  
> >> 
                  
> >> ----Messaggio originale---- 
                  
> >> Da: 
                  canfestival-devel@lists.sourceforge.net
                  
> >> Data: 11-dic-2018 12.21 
                  
> >> A: < 
                  canfestival-devel@lists.sourceforge.net> 
                  
> >> Ogg: [Canfestival-devel] R: R: R: R: Re: R: Re: R: Re: CanFestival on 
> >> ATmega64M1 in Arduino IDE 
                  
> >> 
                  
> >> hello, 
                  
> >> I found a strange bug with setting 16bit registers. 
                  
> >> 
                  
> >> I tried to set 16 bit register OCR1B, but only the lower 8 bits were 
> >> applied. 
                  
> >> 
                  
> >> The datasheet says that for OCR1B you have to first set the upper byte as 
> >> documented, and afterwards commit with the lower byte. 
                  
> >> this however does not work for me. 
                  
> >> 
                  
> >> 
                  
> >> ----Messaggio originale---- 
                  
> >> Da: 
                  canfestival-devel@lists.sourceforge.net
                  
> >> Data: 11-dic-2018 11.30 
                  
> >> A: < 
                  canfestival-devel@lists.sourceforge.net> 
                  
> >> Ogg: [Canfestival-devel] R: R: R: Re: R: Re: R: Re: CanFestival on 
> >> ATmega64M1 in Arduino IDE 
                  
> >> 
                  
> >> Hi, 
                  
> >> something strange compare if I try to debug the TCNT1 and OCR1B values. 
                  
> >> 
                  
> >> Why I get only values from 0 to 255? 
                  
> >> 
                  
> >> The timer1 is a 16bit timer 
                  
> >> 
                  
> >> ??????????????????? 
                  
> >> 
                  
> >> ----Messaggio originale---- 
                  
> >> Da: 
                  canfestival-devel@lists.sourceforge.net
                  
> >> Data: 11-dic-2018 10.04 
                  
> >> A: < 
                  canfestival-devel@lists.sourceforge.net> 
                  
> >> Ogg: [Canfestival-devel] R: R: Re: R: Re: R: Re: CanFestival on ATmega64M1 
> >> in Arduino IDE 
                  
> >> 
                  
> >> Hi, 
                  
> >> 
                  
> >> probably the issue is that for the ATmega64M1 I have to use the TIMER1 in 
> >> CTC mode up to OCR1A as top value? 
                  
> >> 
                  
> >> ----Messaggio originale---- 
                  
> >> Da: 
                  canfestival-devel@lists.sourceforge.net
                  
> >> Data: 11-dic-2018 9.12 
                  
> >> A: < 
                  canfestival-devel@lists.sourceforge.net> 
                  
> >> Ogg: [Canfestival-devel] R: Re: R: Re: R: Re: CanFestival on ATmega64M1 in 
> >> Arduino IDE 
                  
> >> 
                  
> >> I'm using 8MHz external clock. 
                  
> >> 
                  
> >> Timer should be 8us per tick since that I'm using the clkio/64 prescaler. 
                  
> >> 
                  
> >> So the timing frequency is, or I suppose, 125Khz --> 8us. 
                  
> >> 
                  
> >> // The timer is incrementing every 8 us. 
                  
> >> #define MS_TO_TIMEVAL(ms) ((ms) * 125) 
                  
> >> #define US_TO_TIMEVAL(us) ((us)>>3) 
                  
> >> 
                  
> >> This definition seems to be correct because each timer tick = 8us. 
                  
> >> 
                  
> >> In order to have us we have to divide the tick count value by 8 (>>3) 
> >> instead to have ms we have to multiply by 125. 
                  
> >> 
                  
> >> It seems exact. 
                  
> >> 
                  
> >> Why you told me that this define are incorrect? 
                  
> >> 
                  
> >> 
                  
> >> 
                  
> >> 
                  
> >> ----Messaggio originale---- 
                  
> >> Da: 
                  canfestival-devel@lists.sourceforge.net
                  
> >> Data: 10-dic-2018 20.58 
                  
> >> A: < 
                  canfestival-devel@lists.sourceforge.net> 
                  
> >> Ogg: Re: [Canfestival-devel] R: Re: R: Re: CanFestival on ATmega64M1 in 
> >> Arduino IDE 
                  
> >> 
                  
> >> This I should be able to help you with 
                  
> >> in timerscfg.h there are two macros that need to be correct 
                  
> >> MS_TO_TIMEVAL and US_TO_TIMEVAL 
                  
> >> 
                  
> >> They are used to convert ms and us to timer ticks (TIMEVAL) 
                  
> >> 
                  
> >> What clock frequency are you using? 
                  
> >> On Mon, Dec 10, 2018 at 3:13 PM < 
                  canfestival-devel@lists.sourceforge.net> wrote: 
                  
> >> > 
                  
> >> > Hi, 
                  
> >> > 
                  
> >> > the issue seems relative to the timer event. 
                  
> >> > 
                  
> >> > If I program a transmist PDO every 100ms I can see at the beginning some 
> >> > PDO every 1 or 2 ms. 
                  
> >> > 
                  
> >> > After that the CANNUS stacks and I cannot receive PDOs anymore up to a 
> >> > new uC master reset, so a new canbus initialization process. 
                  
> >> > 
                  
> >> > Basically the  timer_AVR.c file is exactly equal to the original one 
> >> > (for the at90can128) except in the initTimer function where I use the 
> >> > timer1 because the ATmega64M1 doesn't have the timer3 
                  
> >> > 
                  
> >> > void initTimer(void) 
                  
> >> > /******************************************************************************
> >> >  
                  
> >> > Initializes the timer, turn on the interrupt and put the interrupt time 
> >> > to zero 
                  
> >> > INPUT    void 
                  
> >> > OUTPUT    void 
                  
> >> > ******************************************************************************/
> >> >  
                  
> >> > { 
                  
> >> >   TimerAlarm = 0;            // Set it back to the zero 
                  
> >> > 
                  
> >> >   // Set timer 1 for CANopen operation tick 8us max, time is 524ms 
                  
> >> >   TCCR1B = (1 << CS11) | (1 << CS10);   // Timer 1 normal, mit CK/64 
                  
> >> >   TIMSK1 = 1 << OCIE1B;                 // Enable the interrupt 
                  
> >> > } 
                  
> >> > 
                  
> >> > Any comment/suggestion? 
                  
> >> > 
                  
> >> > Thanks in advance 
                  
> >> > 
                  
> >> > ----Messaggio originale---- 
                  
> >> > Da: 
                  canfestival-devel@lists.sourceforge.net
                  
> >> > Data: 6-dic-2018 21.04 
                  
> >> > A: < 
                  canfestival-devel@lists.sourceforge.net> 
                  
> >> > Ogg: Re: [Canfestival-devel] R: Re: CanFestival on ATmega64M1 in Arduino 
> >> > IDE 
                  
> >> > 
                  
> >> > Hi, 
                  
> >> > I do not have access to a ATmega64M1, so there is no way AFIK for me 
                  
> >> > to run and debug your code. 
                  
> >> > Also near zero experience with Arduino, lots of experience with 
                  
> >> > at90can128 though. 
                  
> >> > 
                  
> >> > I could always look at your code, but without knowing the general 
                  
> >> > place where the problem is, it is close to impossible... for me :) 
                  
> >> > 
                  
> >> > When you say that only thing that is working is THE nmt message. 
                  
> >> > Is there only one nmt message? 
                  
> >> > What nmt state is the node in? 
                  
> >> > Have you tried to set it to operational state? 
                  
> >> > 
                  
> >> > Best Regards 
                  
> >> > Lars 
                  
> >> > On Tue, Dec 4, 2018 at 5:26 PM < 
                  canfestival-devel@lists.sourceforge.net> wrote: 
                  
> >> > > 
                  
> >> > > The only thing which is working is the NMT message at the startup. 
                  
> >> > > 
                  
> >> > > No SDO response and I cannot able to make debug now. 
                  
> >> > > 
                  
> >> > > Can I attach the whole directory project which stay in the 
> >> > > Arduino/libraries folder to give you the whole files package? 
                  
> >> > > 
                  
> >> > > Thanks 
                  
> >> > > 
                  
> >> > > Bye 
                  
> >> > > 
                  
> >> > > Alessio 
                  
> >> > > 
                  
> >> > > ----Messaggio originale---- 
                  
> >> > > Da: 
                  canfestival-devel@lists.sourceforge.net
                  
> >> > > Data: 3-dic-2018 17.52 
                  
> >> > > A: < 
                  canfestival-devel@lists.sourceforge.net> 
                  
> >> > > Ogg: Re: [Canfestival-devel] CanFestival on ATmega64M1 in Arduino IDE 
                  
> >> > > 
                  
> >> > > Hi, 
                  
> >> > > Does anything work? 
                  
> >> > > Like heartbeat or sdo? 
                  
> >> > > 
                  
> >> > > could you check if the code reaches buildPDO? 
                  
> >> > > 
                  
> >> > > Best Regards 
                  
> >> > > Lars 
                  
> >> > > 
                  
> >> > > On Sat, Dec 1, 2018 at 6:02 PM < 
                  canfestival-devel@lists.sourceforge.net> wrote: 
                  
> >> > > > 
                  
> >> > > > 
                  
> >> > > > Dear all, 
                  
> >> > > > 
                  
> >> > > > first of all many thanks to the developers and people in general 
> >> > > > that spent time on this project making it an affordable CanOpen 
> >> > > > platform for everyone. 
                  
> >> > > > 
                  
> >> > > > I'm new on this mailing list and here to explain my problem. 
                  
> >> > > > 
                  
> >> > > > I'm an electronic engineer and a researcher of University of Brescia 
> >> > > > (Italy) and I'm trying to make the canFestival working on Arduino 
> >> > > > using the Atmega64M1 uC. 
                  
> >> > > > 
                  
> >> > > > I know that there is the CanFestivino project that is the 
> >> > > > CanFestival porting for the Arduino IDE and the Atmega328p with the 
> >> > > > external controller MCP2515. 
                  
> >> > > > 
                  
> >> > > > It works but the guy that makes the porting cut several features to 
> >> > > > fit the code with the Atmega328 ROM and RAM. 
                  
> >> > > > 
                  
> >> > > > I reached it compilable in Arduino starting from the AVR example for 
> >> > > > the ATCAN90128. This uC is very similar to the ATmega64M1. 
                  
> >> > > > 
                  
> >> > > > The only things that I did was to change the timer, from timer3 to 
> >> > > > timer1 (timer3 is not present on the ATmega64M1) and some tiny 
> >> > > > modifications in the CAN driver. 
                  
> >> > > > 
                  
> >> > > > Actually my project is compilable in Arduino where I created an 
> >> > > > example to read an analog input (A0) sending it through a PDO each 
> >> > > > 100ms. 
                  
> >> > > > 
                  
> >> > > > The only thing to need in order to compile it is the Arduino IDE 
> >> > > > support files for CAN enabled Amtel AVR chips: ATmega64M1, 
> >> > > > ATmega32M1, ...HERE. 
                  
> >> > > > 
                  
> >> > > > I cannot figure out why but actually the example doesn't work and 
> >> > > > I'm struggling on it....making me a bit crazy because I don't 
> >> > > > understand why. 
                  
> >> > > > 
                  
> >> > > > 
                  
> >> > > > 
                  
> >> > > > Hope that someone can help me in this.... 
                  
> >> > > > 
                  
> >> > > > Thanks 
                  
> >> > > > 
                  
> >> > > > Alessio 
                  
> >> > > > _______________________________________________ 
                  
> >> > > > Canfestival-devel mailing list 
                  
> >> > > > 
                  Canfestival-devel@lists.sourceforge.net
                  
> >> > > > 
                  https://lists.sourceforge.net/lists/listinfo/canfestival-devel
                  
> >> > > 
                  
> >> > > 
                  
> >> > > _______________________________________________ 
                  
> >> > > Canfestival-devel mailing list 
                  
> >> > > 
                  Canfestival-devel@lists.sourceforge.net
                  
> >> > > 
                  https://lists.sourceforge.net/lists/listinfo/canfestival-devel
                  
> >> > > 
                  
> >> > > 
                  
> >> > > _______________________________________________ 
                  
> >> > > Canfestival-devel mailing list 
                  
> >> > > 
                  Canfestival-devel@lists.sourceforge.net
                  
> >> > > 
                  https://lists.sourceforge.net/lists/listinfo/canfestival-devel
                  
> >> > 
                  
> >> > 
                  
> >> > _______________________________________________ 
                  
> >> > Canfestival-devel mailing list 
                  
> >> > 
                  Canfestival-devel@lists.sourceforge.net
                  
> >> > 
                  https://lists.sourceforge.net/lists/listinfo/canfestival-devel
                  
> >> > 
                  
> >> > 
                  
> >> > _______________________________________________ 
                  
> >> > Canfestival-devel mailing list 
                  
> >> > 
                  Canfestival-devel@lists.sourceforge.net
                  
> >> > 
                  https://lists.sourceforge.net/lists/listinfo/canfestival-devel
                  
> >> 
                  
> >> 
                  
> >> _______________________________________________ 
                  
> >> Canfestival-devel mailing list 
                  
> >> 
                  Canfestival-devel@lists.sourceforge.net
                  
> >> 
                  https://lists.sourceforge.net/lists/listinfo/canfestival-devel
                  
> >> 
                  
> >> 
                  
> >> 
                  
> >> 
                  
> >> 
                  
> >> 
                  
> >> 
                  
> >> 
                  
> >> 
                  
> >> 
                  
> >> 
                  
> >> 
                  
> >> 
                  
> >> 
                  
> >> 
                  
> >> 
                  
> >> 
                  
> >> 
                  
> >> _______________________________________________ 
                  
> >> Canfestival-devel mailing list 
                  
> >> 
                  Canfestival-devel@lists.sourceforge.net
                  
> >> 
                  https://lists.sourceforge.net/lists/listinfo/canfestival-devel
                  
> > 
                  
> > 
                  
> > 
                  
> > _______________________________________________ 
                  
> > Canfestival-devel mailing list 
                  
> > 
                  Canfestival-devel@lists.sourceforge.net
                  
> > 
                  https://lists.sourceforge.net/lists/listinfo/canfestival-devel
                  
> 
                  
> 
                  
> _______________________________________________ 
                  
> Canfestival-devel mailing list 
                  
> 
                  Canfestival-devel@lists.sourceforge.net
                  
> 
                  https://lists.sourceforge.net/lists/listinfo/canfestival-devel
                  
> 
                  
> 
                  
> _______________________________________________ 
                  
> Canfestival-devel mailing list 
                  
> 
                  Canfestival-devel@lists.sourceforge.net
                  
> 
                  https://lists.sourceforge.net/lists/listinfo/canfestival-devel
                  

                  

                  
_______________________________________________ 
                  
Canfestival-devel mailing list 
                  

                  Canfestival-devel@lists.sourceforge.net
                  

                  https://lists.sourceforge.net/lists/listinfo/canfestival-devel
                  

                  

                 
                 
_______________________________________________ 
                 
 Canfestival-devel mailing list 
                 

                 Canfestival-devel@lists.sourceforge.net
                 

                 https://lists.sourceforge.net/lists/listinfo/canfestival-devel
                 

                
               
               

              
              

              

             
             

             

            
            

            

           
           

           

          
          
_______________________________________________ 
          
 Canfestival-devel mailing list 
          

          Canfestival-devel@lists.sourceforge.net
          

          https://lists.sourceforge.net/lists/listinfo/canfestival-devel
          

         
        
       
      
      

     
     

     

    
    
_______________________________________________ 
    
 Canfestival-devel mailing list 
    

    Canfestival-devel@lists.sourceforge.net
    

    https://lists.sourceforge.net/lists/listinfo/canfestival-devel
    

   
  
  

 
 

 



_______________________________________________
Canfestival-devel mailing list
Canfestival-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/canfestival-devel

Reply via email to