Italy
Offline
Full Member
Karma: 6
Posts: 102
|
 |
« Reply #120 on: June 29, 2012, 05:24:13 am » |
lesto hai dimenticato di togliere l'http  EDIT: scaricato, thanks 4 sharing!
|
|
|
|
« Last Edit: June 29, 2012, 05:27:36 am by superp »
|
Logged
|
"The question is not whether intelligent machines can have emotions, but whether machines can be intelligent without any emotions"
|
|
|
|
Forum Moderator
Italy
Offline
Brattain Member
Karma: 219
Posts: 16495
Don't know what I do
|
 |
« Reply #121 on: June 29, 2012, 05:41:50 am » |
L'ho scaricato anch'io, oggi gli darò un'occhiata.
@superp: non scherzare, ti ho solo riassunto ciò che ho letto ed imparato dal datasheet. Per ora niente libri, quello che so l'ho imparato in "autoapprendimento"
|
|
|
|
|
Logged
|
|
|
|
|
Italy
Offline
Full Member
Karma: 6
Posts: 102
|
 |
« Reply #122 on: June 29, 2012, 11:22:55 am » |
mmm sono molto perplesso riguardo la mia leonardo. qualunque codice carico prima di eseguirlo fa quella pulsazione descritta qualche post fa, sempre 14 volte. magari aprirò un thread nuovo...prima cerco di capire e fare qulache altra prova N.
|
|
|
|
|
Logged
|
"The question is not whether intelligent machines can have emotions, but whether machines can be intelligent without any emotions"
|
|
|
|
Forum Moderator
Italy
Offline
Brattain Member
Karma: 219
Posts: 16495
Don't know what I do
|
 |
« Reply #123 on: June 29, 2012, 01:58:35 pm » |
La Leonardo è una scheda particolare. Essendo basata su un unico chip che gestisce sia la comunicazione seriale che il normale sketch utente, ha un bootloader un po' diverso dal solito, e gestisce la programmazione della flash in maniera differente. http://arduino.cc/en/Main/ArduinoBoardLeonardoGuarda poi sul forum internazionale se qualcuno ha manifestato i tuoi stessi problemi.
|
|
|
|
|
Logged
|
|
|
|
|
Italy
Offline
Full Member
Karma: 6
Posts: 102
|
 |
« Reply #124 on: June 30, 2012, 03:15:25 am » |
Allora questo thread sul forum internazionale mi ha illuminato If you manually reset the board does the LED "breathe" for several seconds? Once it stops breathing does it start blinking with a period of two seconds?
No.
On this part specifically, does the LED "breathe" after a manual reset? And, fter a few seconds of breathing does it start blinking with a period of two seconds? In normal operation those are two distinct phases. Breathing indicates that the bootloader is running. After the bootloader runs for a few seconds it starts the sketch. On a fresh board you should see blinking because they load the Blink sketch at the factory to test. Of course, if you've managed to upload any sketch it will overwrite Blink but it doesn't sound like you've ever had success? Also, can you confirm that Device Manager shows the board enumerated and drivers loaded in both bootloader and sketch mode? Just open Device Manager, check that you have an entry for the Leonardo without any errors or warnings (sketch mode), then manually reset the board and confirm that it comes up again with no errors or warnings (bootloader mode). Eventually it should automatically reset and go back into sketch mode. If you want to confirm which you're seeing, look at the PIDs: 0x0034 is bootloader, 0x8034 is sketch. quindi il pulsare, che il buon zeveland chiama respirare, è assolutamente normale, indica che il bootloader sta girando. Quindi, considerando che le 14 pulsazioni rientrano nel normale funzionamento, al momento su leonardo l'unico problema della leOS è che il blink vien fatto ogni 3/4 secondi invece che ogni secondo (blinkWithoutMillis) @leo p.s. ho visto il post sul forum internazionale.....davvero poca attenzione, strano...a me continua a sembrare una figata 
|
|
|
|
|
Logged
|
"The question is not whether intelligent machines can have emotions, but whether machines can be intelligent without any emotions"
|
|
|
|
Forum Moderator
Italy
Offline
Brattain Member
Karma: 219
Posts: 16495
Don't know what I do
|
 |
« Reply #125 on: June 30, 2012, 03:42:12 am » |
Che poi i "pochi secondi" sarebbero in realtà circa 8, stando almeno a quanto c'è scritto nella sezione Hardware sulla scheda della Leonardo. Sì, a 'sto punto pare che il problema sia un altro: Quindi, considerando che le 14 pulsazioni rientrano nel normale funzionamento, al momento su leonardo l'unico problema della leOS è che il blink vien fatto ogni 3/4 secondi invece che ogni secondo (blinkWithoutMillis)
|
|
|
|
|
Logged
|
|
|
|
|
Forum Moderator
Italy
Offline
Brattain Member
Karma: 219
Posts: 16495
Don't know what I do
|
 |
« Reply #126 on: July 02, 2012, 04:44:02 am » |
Oggi mi è arrivata la Leonardo  Però non ho un cavetto compatibile: la scheda ha un connettore micro-USB (forse era meglio mini-USB), mi tocca andare a cercarlo. Quindi fino a domani niente prove. 
|
|
|
|
|
Logged
|
|
|
|
|
Cagliari
Offline
Faraday Member
Karma: 49
Posts: 3030
|
 |
« Reply #127 on: July 02, 2012, 04:58:07 am » |
Oggi mi è arrivata la Leonardo  Però non ho un cavetto compatibile: la scheda ha un connettore micro-USB (forse era meglio mini-USB), mi tocca andare a cercarlo. Quindi fino a domani niente prove.  Cavetto per macchina fotografica, cellulare, alcuni navigatori satellitari. Possibile non ne abbia neanche uno? Magari dalla vicina di casa? (Una volta si chiedeva lo zucchero... oggi i cavetti USB  )
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Edison Member
Karma: 16
Posts: 1802
|
 |
« Reply #128 on: July 02, 2012, 05:03:06 am » |
io ne ho 5 o 6 in giro ormai è diventato uno standard , cerca bene 
|
|
|
|
|
Logged
|
"Due cose sono infinite: l'universo e la stupidità umana, ma riguardo l'universo ho ancora dei dubbi..." Albert Einstein
|
|
|
|
0
Offline
Tesla Member
Karma: 83
Posts: 8239
:(){:|:&};:
|
 |
« Reply #129 on: July 02, 2012, 05:04:03 am » |
lascia stare va, che l'unico cavetto micro USB che avevo l'ho perso. meno male che l'alimenttore del raspberry PI è micro USB e riesco ad alimentarci anche il cellulare  edit: comuque l'attacco micro-USB, per via di quei "gancetti" mi pare molto più stabile del mini-USB
|
|
|
|
« Last Edit: July 02, 2012, 05:07:58 am by lesto »
|
Logged
|
|
|
|
|
Offline
Edison Member
Karma: 16
Posts: 1802
|
 |
« Reply #130 on: July 02, 2012, 05:06:04 am » |
lascia stare va, che l'unico cavetto micro USB che avevo l'ho perso. meno male che l'alimenttore del raspberry PI è micro USB e riesco ad alimentarci anche il cellulare  wow il raspberry, stavo pensando di prendere uno anche io può sempre essere utile, perchè(se non è di troppo disturbo) non scrivi nua recensione nel post dedicato al rasp? 
|
|
|
|
|
Logged
|
"Due cose sono infinite: l'universo e la stupidità umana, ma riguardo l'universo ho ancora dei dubbi..." Albert Einstein
|
|
|
|
Forum Moderator
Italy
Offline
Brattain Member
Karma: 219
Posts: 16495
Don't know what I do
|
 |
« Reply #131 on: July 02, 2012, 05:29:30 am » |
Le mie macchine fotografiche vanno con mini-USB, non sono recentissime. Il micro-USB si è diffuso ultimamente sugli smartphone, che però io non ho. Per cui domattina a comprare il cavetto 
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Edison Member
Karma: 9
Posts: 2191
Arduino rocks
|
 |
« Reply #132 on: July 02, 2012, 05:52:24 am » |
Guardavo il codice di leOS al fine di rubare qualcosa di pronto da usare  Ho trovato l'inizializzazione del timer 2 che fa al caso mio, ma mi sono detto perchè leo usa inizializzare il timer a run-time, in base alla frequenza F_CPU. Il micro lo scegli con il preprocessore, allora perchè non lasciargli il compito di scegliere anche l'inizializzazione dei registri del timer 2. Meglio il codice, così è più chiaro: // ***** Codice originale più le note a fine if o #if *****
void leOS::setTimer() { float prescaler = 0.0;
#if defined (ATMEGAx8) || defined (ATMEGA644) || defined (ATMEGAx0) // Nota: usa il preprocessore //during setup, disable all the interrupts based on timer TIMSK2 &= ~((1<<TOIE2) | (1<<OCIE2A) | (1<<OCIE2B)); //prescaler source clock set to internal Atmega clock (asynch mode) ASSR &= ~(1<<AS2); //this sets the timer to increment the counter until overflow TCCR2A &= ~((1<<WGM21) | (1<<WGM20)); TCCR2B &= ~(1<<WGM22); //the following code sets the prescaler depending on the system clock if (F_CPU == 16000000UL) { // prescaler set to 64 Nota: qui siamo a runtime TCCR2B |= (1<<CS22); TCCR2B &= ~((1<<CS21) | (1<<CS20)); prescaler = 64.0; } else if ((F_CPU == 8000000UL) || (F_CPU == 4000000UL)) { // prescaler set to 32 Nota: qui siamo a runtime TCCR2B &= ~(1<<CS22); TCCR2B |= ((1<<CS21) | (1<<CS20)); prescaler = 32.0; } else if (F_CPU == 1000000UL) { // prescaler set to 8 Nota: qui siamo a runtime TCCR2B &= ~((1<<CS22) | (1<<CS20)); TCCR2B |= (1<<CS21); prescaler = 8.0; } #elif defined (ATTINYx5) || defined (ATTINYx313) //during setup, disable all the interrupts based on timer 0 TIMSK &= ~((1<<TOIE0) | (1<<OCIE0A) | (1<<OCIE0B)); //normal mode: counter not connected to external pins TCCR0A &= ~((1<<COM0A0) | (1<<COM0A1)); //this sets the timer to increment the counter until overflow TCCR0A &= ~((1<<WGM01) | (1<<WGM00)); TCCR0B &= ~(1<<WGM02); //the following code sets the prescaler depending on the system clock if ((F_CPU == 16000000UL) || (F_CPU == 8000000UL)) { // prescaler set to 64 Nota: qui siamo a runtime TCCR0B &= ~(1<<CS02); TCCR0B |= ((1<<CS01) | (1<<CS00)); prescaler = 64.0; } else if (F_CPU == 1000000UL) { // prescaler set to 8 Nota: qui siamo a runtime TCCR0B &= ~((1<<CS02) | (1<<CS00)); TCCR0B |= (1<<CS01); prescaler = 8.0; } #elif defined (ATTINYx4) //on Attinyx4 we must use the timer 0 because timer1 is a 16 bit counter //during setup, disable all the interrupts based on timer 0 TIMSK0 &= ~((1<<TOIE0) | (1<<OCIE0A) | (1<<OCIE0B)); //normal mode: increment counter until overflow & disconnect timer from pins TCCR0B &= ~(1<<WGM02); TCCR0A &= ~((1<<WGM01) | (1<<WGM00) | (1<<COM0A0) | (1<<COM0A1)); //the following code sets the prescaler depending on the system clock if ((F_CPU == 16000000UL) || (F_CPU == 8000000UL)) { // prescaler set to 64 Nota: qui siamo a runtime TCCR0B &= ~(1<<CS02); TCCR0B |= ((1<<CS01) | (1<<CS00)); prescaler = 64.0; } else if (F_CPU == 1000000UL) { // prescaler set to 8 Nota: qui siamo a runtime TCCR0B &= ~((1<<CS02) | (1<<CS00)); TCCR0B |= (1<<CS01); prescaler = 8.0; } #elif defined (ATMEGA8) //during setup, disable all the interrupts based on timer2 TIMSK &= ~((1<<TOIE2) | (1<<OCIE2)); //normal mode: counter incremented until overflow TCCR2 &= ~((1<<WGM21) | (1<<WGM20)); //prescaler source clock set to internal Atmega clock (asynch mode) ASSR &= ~(1<<AS2); if (F_CPU == 1600000UL) { // prescaler set to 64 Nota: qui siamo a runtime TCCR2 |= (1<<CS22); TCCR2 &= ~((1<<CS21) | (1<<CS20)); prescaler = 64.0; } else if ((F_CPU == 8000000UL) || (F_CPU == 4000000UL)) { // prescaler set to 32 Nota: qui siamo a runtime TCCR2 &= ~(1<<CS22); TCCR2 |= ((1<<CS21) | (1<<CS20)); prescaler = 32.0; } else if (F_CPU == 1000000L) { // prescaler set to 8 Nota: qui siamo a runtime TCCR2 |= (1<<CS21); TCCR2 &= ~((1<<CS22) | (1<<CS20)); prescaler = 8.0; } #elif defined (ATMEGAxU) //during setup, disable all the interrupts based on timer3 //TIMSK3 &= ~((1<<TOIE3) | (1<<OCIE3A) | (1<<OCIE3B) | (1<<OCIE3C) | (1<<ICIE3)); TIMSK3 = 0; //normal mode: counter incremented until overflow, prescaler set to /1 //TCCR3A &= ~((1<<WGM31) | (1<<WGM30)); TCCR3A = 0; //TCCR3B &= ~((1<<WGM33) | (1<<WGM32) | (1<<CS32) | (1<<CS31)); //TCCR3B |= (1<<CS30); TCCR3B = 1; #endif
//set the initial value of the counter depending on the prescaler #if defined (ATMEGAxU) _starter = 49536; #else _starter = 256 - (int)((float)F_CPU * 0.001 / prescaler); #endif
//start the counter #if defined (ATMEGAx8) || defined (ATMEGA644) || defined (ATMEGAx0) TCNT2 = _starter; TIMSK2 |= (1<<TOIE2); #elif defined (ATMEGA8) TCNT2 = _starter; TIMSK |= (1<<TOIE2); #elif defined (ATTINYx5) || defined (ATTINYx313) TCNT0 = _starter; TIMSK |= (1<<TOIE0); #elif defined (ATTINYx4) TCNT0 = _starter; TIMSK0 |= (1<<TOIE0); #elif defined (ATMEGAxU) //TCNT3H = (_starter>>8); //TCNT3L = (_starter & 0x00FF); TCNT3 = _starter; TIMSK3 |= (1<<TOIE3); #endif SREG |= (1<<SREG_I); }
Ora segue il codice modificato per usare il preprocessore, ma solo quello che riguarda ATmega328 #if defined (ATMEGAx8) || defined (ATMEGA644) || defined (ATMEGAx0) // Nota: usa il preprocessore //during setup, disable all the interrupts based on timer TIMSK2 &= ~((1<<TOIE2) | (1<<OCIE2A) | (1<<OCIE2B)); //prescaler source clock set to internal Atmega clock (asynch mode) ASSR &= ~(1<<AS2); //this sets the timer to increment the counter until overflow TCCR2A &= ~((1<<WGM21) | (1<<WGM20)); TCCR2B &= ~(1<<WGM22);
//the following code sets the prescaler depending on the system clock #if F_CPU == 16000000UL // prescaler set to 64 Nota:
TCCR2B |= (1<<CS22); TCCR2B &= ~((1<<CS21) | (1<<CS20)); #define starter 256 - (int)((float)F_CPU * 0.001 / 64.0)
#elif F_CPU == 8000000UL || F_CPU == 4000000UL // prescaler set to 32 Nota: usa il preprocessore
TCCR2B &= ~(1<<CS22); TCCR2B |= ((1<<CS21) | (1<<CS20)); #define starter 256 - (int)((float)F_CPU * 0.001 / 32.0)
#elif F_CPU == 1000000UL // prescaler set to 8 Nota: usa il preprocessore TCCR2B &= ~((1<<CS22) | (1<<CS20)); TCCR2B |= (1<<CS21); #define starter 256 - (int)((float)F_CPU * 0.001 / 8.0)
Ora mi chiedo cosa comporta questa implementazione? mi rispondo: nulla perchè non possiamo cambiare F_CPU a run-time, stessa cosa per starter. Che ne dici, mi sfugge qualcosa? Ciao.
|
|
|
|
|
Logged
|
|
|
|
|
Italy
Offline
Full Member
Karma: 6
Posts: 102
|
 |
« Reply #133 on: July 02, 2012, 05:54:31 am » |
Oggi mi è arrivata la Leonardo  Però non ho un cavetto compatibile: la scheda ha un connettore micro-USB (forse era meglio mini-USB), mi tocca andare a cercarlo. Quindi fino a domani niente prove.  Quale versione ti hanno mandato, con o senza headers? N.
|
|
|
|
|
Logged
|
"The question is not whether intelligent machines can have emotions, but whether machines can be intelligent without any emotions"
|
|
|
|
Forum Moderator
Italy
Offline
Brattain Member
Karma: 219
Posts: 16495
Don't know what I do
|
 |
« Reply #134 on: July 02, 2012, 06:17:57 am » |
@Mauro: sono di fretta, guardo e studio il tuo intervento più tardi..  @Testato: con headers, molto bellina 
|
|
|
|
|
Logged
|
|
|
|
|
|