Trouble Atmega 328 running a 1 Mhz No Clock extern

Atmega328p running at 8 mhz Inter Clock everything OK
Atmega328 running at 1 Mhz using DIV by 8 Getting 1 mhz Clock No works Serial.print funtions only get Garbage

Can Someone help me ?

Thanks in advance

Brunswick Gauss

p.d.

I am sorry for my bad english
Forgive me for Not to Say Hello
Is very poor my english languaje
But i can read a little bit

Did you try changing the serial monitor to a speed that is 1/8 slower?
Or increasing the speed by 8 in the sketch?

Thanks for your soon reply

Yes i have tested several velocitys

No works

I have one week triying but i can not

For me is amazing that delay() with 1 mhz Clock works very well but Not Serial.print

Brunswick

SPI Works
Delay Works
But Serial.print functios no works

I have conected nrf24L01 to Atmeg328P at 1 MHZ Clock and this works ok
I wanted to use 1 MHZ to save energy from the battery but 3.2 volts not is enough for nrf24L01

The Atmega328P works with 2.00 volts

Brunswick

For serial it is best to use an external crystal so the timing is much more accurate. You can use a 16MHz crystal or resonator and divide by 8 with the fuse setting. You can then have accurate serial and the MCU will run as low as 1.8V.

dmjlambert

Thanks for your comments

But I need save energy using battery, to get this is better No Using Extern Crystal

Brunswick

What speed are you trying to use?

I have tested all

From 300 to 115200 In the two sides, in atmega328P and monitor

No works yet

BrunswickGauss:
Can Someone help me ?

You'll have to post code. Everything else is guesswork.

BrunswickGauss:
dmjlambert

Thanks for your comments

But I need save energy using battery, to get this is better No Using Extern Crystal

Brunswick

You may be surprised to learn that the low power crystal oscillator requires less power than the internal RC one.

This example I have got of this website

A excelent web in spanish about Arduino, I think is Better than others in Spanish... in Spanish

/*  ----------------------------------------------------------------
   http://www.prometec.net/duplex-nrf2401
   Prog_79B_Emisor
   
   Usando un NRF2401 para comunicar dos Arduinos en modo Duplex
   Programa Emisor:
--------------------------------------------------------------------  
*/ 
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"

RF24 radio(9,10);

const uint64_t pipes[2] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL };

void setup(void)
{
   pinMode(10, OUTPUT); 
   Serial.begin(9600);
   radio.begin();
 
   radio.setRetries(15,15);   // Maximos reintentos 
   //radio.setPayloadSize(8);   // Reduce el payload de 32 si tienes problemas
 
   // Open pipes to other nodes for communication
   radio.openWritingPipe(pipes[0]);
   radio.openReadingPipe(1,pipes[1]);
}

void loop(void)
{
   radio.stopListening();    // Paramos la escucha para poder hablar
   unsigned long time = millis();
   Serial.print("Enviando  ");
   Serial.println(time);
   bool ok = radio.write( &time, sizeof(unsigned long) );

   if (ok)
       Serial.println("ok...");
   else
       Serial.println("failed");

   radio.startListening();   //Volvemos a la escucha

   unsigned long started_waiting_at = millis();
   bool timeout = false;
   while ( ! radio.available() && ! timeout )  // Esperasmos repsuesta hasta 200ms
       if (millis() - started_waiting_at > 200 )timeout = true;
   
   if ( timeout )
        Serial.println("Failed, response timed out");
   else
     { // Leemos el mensaje recibido
       unsigned long got_time;
       radio.read( &got_time, sizeof(unsigned long) );

       Serial.print("Respuesta = ");
       Serial.println(got_time);
     }
   delay(500);
}

Jiggy-Ninja:
You may be surprised to learn that the low power crystal oscillator requires less power than the internal RC one.

Really ?

Can you tell me where Can I Purchase someone of those ?

Low Power Crystal

Thanks in advance

Brunswick

Please edit your post, select the code, and put it between [code] ... [/code] tags.

You can do that by hitting the "Code" icon above the posting area. It is the first icon, with the symbol: </>

How to use this forum

Jiggy-Ninja:
You may be surprised to learn that the low power crystal oscillator requires less power than the internal RC one.

I had been looking for in newark.com low power crystal but No success

may be I dont Know how look for

Thanks

Brunswick

You would use a regular crystal or resonator. Then set the fuse settings for low-power crystal oscillator. I recommend reading the ATmega328P data sheet. Google online fuse calculator and play with a fuse calculator to easily compute the values. Do some experimenting and measuring.

BrunswickGauss:
Really ?

Can you tell me where Can I Purchase someone of those ?

Low Power Crystal

Thanks in advance

Brunswick

It's not an oscillator that uses a low power crystal, but a crystal oscillator that uses low power. As for where to buy them:

DX
Ebay
Aliexpress
Mouser
Digikey
Newark
Element14

You have options.

Jiggy-Ninja:
It's not an oscillator that uses a low power crystal, but a crystal oscillator that uses low power. As for where to buy them:

DX
Ebay
Aliexpress
Mouser
Digikey
Newark
Element14

You have options.

ahhh Ok I have understood but I made this test and I have got better results with internal Clock than external Clock, I have got more duration of batteries with External Clock, may be I made something wrong.

Thanks everybody for your help

Brunswick

dmjlambert:
You would use a regular crystal or resonator. Then set the fuse settings for low-power crystal oscillator. I recommend reading the ATmega328P data sheet. Google online fuse calculator and play with a fuse calculator to easily compute the values. Do some experimenting and measuring.

I have madetestin And...I have got better result with Internal Clock

Using external Clock 16 Mhz the battery is during 168 Hours progresives
Using internal Clock 8 Mhz the baterry is during 336 Hours progresives

Now I am testing Internal Clock1 Mhz ( I am using DIV by 8 ) until now i have got 336 hours y there is still 48% of power.

Now I want to use Attiny85 becouse I want a small printed circuit, But I had not got that this works
I have problems using NRF24L01 and Attiny together

Brunwick

I send pictures about my tests
I dont Know if is fault to put pictures, if so, I will erase them.




If you're using something like the example you posted on the last page, there's no sleep modes or power management of any kind being used in that sketch. Further underclocking the microcontroller will have diminishing returns when you've got the nRF24 module in receive mode sucking about a dozen mA all the time.

Also, using the IDLE sleep mode when you don't need to do anything will eliminate a lot of the difference between the different clock speeds.