Author: jaguarondi
Date: 2008-08-26 11:26:00 +0200 (Tue, 26 Aug 2008)
New Revision: 1588
Modified:
firmware/tuxaudio/trunk/main.c
firmware/tuxaudio/trunk/varis.c
firmware/tuxaudio/trunk/varis.h
Log:
* Changed the initialization of the RF and powering of the microphone.
Sometimes the RF didn't start correctly because of this and that was very
frequent on the new produciton.
Modified: firmware/tuxaudio/trunk/main.c
===================================================================
--- firmware/tuxaudio/trunk/main.c 2008-08-26 09:23:32 UTC (rev 1587)
+++ firmware/tuxaudio/trunk/main.c 2008-08-26 09:26:00 UTC (rev 1588)
@@ -135,28 +135,40 @@
int main(void)
{
- init_avr(); // Init AVR
+ init_avr();
- FifoClear(PWMFifo); /* Initialise the PWM fifo */
- FifoClear(ADCFifo); /* Initialise the ADC fifo */
- config_init(); /* load the configuration defaults from EEPROM
*/
+ /* Reset the RF to eliminate timing uncertainties */
+ PORTB &= ~0x80;
+ /* Power the microphone */
+ volatile uint16_t _count;
+ for (_count = 0;_count<0x0FFF; _count++)
+ {
+ uint8_t i;
+ for (i=0x0F; i>_count>>8;i--)
+ DDRD &= ~0x03;
+ for (; i>0;i--)
+ DDRD |= 0x03;
+ }
+ /* Start the RF */
+ PORTB |= 0x80;
+
+ /* Other initializations */
+ FifoClear(PWMFifo);
+ FifoClear(ADCFifo);
+ /* Load configuration defaults from EEPROM */
+ config_init();
numSound = readFlashNumber();
last_block = readLastBlock(numSound);
- communication_init(); /* I2C initialization */
+ communication_init();
frame_without_sound_timeout = TTS_TIMEOUT;
- sei(); /* Init global interrupt */
-
-
- /* Activate INTO and INT1 only if the RF board is present, this is for
- * production tests only.
- * This delay is critical as the INT0 is quite shaky and any glitches on
- * INT0 at the boot of the RF CPU immeditely crash this CPU or set it in
- * the while(1) loop of spi.c */
+ /* Wait for the RF board to signal itself with a stong low on PB6 */
while (RF_ONLINE_PIN & RF_ONLINE_MK);
+
/* Activate the interrupts used by the RF module. */
EIFR = (_BV(INT1) | _BV(INT0));
EIMSK = (_BV(INT1) | _BV(INT0));
+ sei();
while (1) /* Inifinite main loop */
{
@@ -204,23 +216,6 @@
//if (isFifoEmpty(rf_cmdout_buf))
/* wait for audio commands to be processed */
//if (!audioBufIdx && !flashPlay)
-
- /* Delay used to power the IR receiver slowly */
- if (power_on_reset_delay)
- {
- uint8_t volatile j;
-
- DDRD |= 0x03;
- for (j = 0; j < 0xFF; j++) ;
- power_on_reset_delay--;
- if (!power_on_reset_delay)
- {
- /* Set the microphone and IR receiver power */
- DDRD |= 0x03;
- }
- else
- DDRD &= ~0x03;
- }
}
/* Sleep mode */
Modified: firmware/tuxaudio/trunk/varis.c
===================================================================
--- firmware/tuxaudio/trunk/varis.c 2008-08-26 09:23:32 UTC (rev 1587)
+++ firmware/tuxaudio/trunk/varis.c 2008-08-26 09:26:00 UTC (rev 1588)
@@ -63,7 +63,6 @@
unsigned char sendSensorsCmpt, sendSensorsFlag;
unsigned char audio_level, battery_level;
-uint8_t power_on_reset_delay = 20;
volatile unsigned char spiCommandFlasg = 0;
Modified: firmware/tuxaudio/trunk/varis.h
===================================================================
--- firmware/tuxaudio/trunk/varis.h 2008-08-26 09:23:32 UTC (rev 1587)
+++ firmware/tuxaudio/trunk/varis.h 2008-08-26 09:26:00 UTC (rev 1588)
@@ -72,7 +72,6 @@
extern unsigned char sendSensorsCmpt, sendSensorsFlag;
extern unsigned char audio_level, battery_level;
-extern uint8_t power_on_reset_delay;
extern volatile unsigned char testAudio;
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn