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

Reply via email to