Code: Select all
#!/bin/bash
echo Settup the Pi for DS1374
gpio load i2c
sudo modprobe rtc-ds1374
sudo /bin/bash -c "echo ds1374 0x68 > /sys/class/i2c-adapter/i2c-1/new_device"
sudo hwclock -rAndyD wrote:The original tar file (gertduino.tar) on the Element14 website (which was replaced with gertduino.zip). Had a file called setup which contained the following:-
Note I assume gpio is the GPIO utility from Gordon's WiringPi library.Code: Select all
#!/bin/bash echo Settup the Pi for DS1374 gpio load i2c sudo modprobe rtc-ds1374 sudo /bin/bash -c "echo ds1374 0x68 > /sys/class/i2c-adapter/i2c-1/new_device" sudo hwclock -r
Edit: Although it appears you already have the original gertduino.tar file. (There are some transposed characters in the word hwclock in the original version).
Code: Select all
root@NSLraspberrypi:~# hwclock -r --debug
hwclock from util-linux 2.20.1
hwclock: Open of /dev/rtc failed: No such file or directory
No usable clock interface found.
hwclock: Cannot access the Hardware Clock via any known method.But it is possible to program the AVR48 om the Gertduino to work as RTC, you can also emulate exiting RTCs with it and even make it wake up your PI at a certain time.The Pi does not have a RTC. You'd need to buy one as an add-on and install it accordong to the vendor's instructions.
Yes, that's the gpio program from wiringPi - however you don't need wiringPi installed - just modprobe the neccessary I2C modules, or un-blacklist them.AndyD wrote:The original tar file (gertduino.tar) on the Element14 website (which was replaced with gertduino.zip). Had a file called setup which contained the following:-
Note I assume gpio is the GPIO utility from Gordon's WiringPi library.Code: Select all
#!/bin/bash echo Settup the Pi for DS1374 gpio load i2c sudo modprobe rtc-ds1374 sudo /bin/bash -c "echo ds1374 0x68 > /sys/class/i2c-adapter/i2c-1/new_device" sudo hwclock -r
Edit: Although it appears you already have the original gertduino.tar file. (There are some transposed characters in the word hwclock in the original version).
Code: Select all
hwclock: Cannot access the Hardware Clock via any known method.
hwclock: Use the --debug option to see the details of our search for an access method.
Yes! That what to expect.MattHawkinsUK wrote:I'm also getting :
If I run "sudo i2cdetect -y 1" I get "68 69" in the grid so I assume I must be close?Code: Select all
hwclock: Cannot access the Hardware Clock via any known method. hwclock: Use the --debug option to see the details of our search for an access method.
Code: Select all
i2cset -y 1 0x69 0 0xaa
i2cget -y 1 0x69 0Yes. I never did get to the bottom of why leaving the serial port connected caused it to draw more power - even when shutting down the serial hardware and making the pins input... I'm still on my first battery some months down the line, but mine is mostly powered up though. Longest down-time so-far has been 3 weeks.black-cat wrote:It solved my problem. But I'd left it overnight with the programming jumpers and the RS232 links in to the AT48... end result one flat battery
Now to make the RTC give a 1Hz tick to the 328 when the power is on and not drain the battery the rest of the time.
It's supported by Debian/Raspbian and ... it's easy and I was lazy/efficient.texy wrote:Hi,
I don't own a gertduino, but I was wondering why the ds1374 was chosen to be emulated in particular? Is the ds1374 module supported in raspbian by default, or is it added with the gertduino software package? I know ds1307 and maybe others are, but I wasn't sure about the ds1374 (or how to find out exactly what is supported).
Texy
Hi MightySmooth! No, you are on the right track, you do need to runMightySmooth wrote:...I assume i'm missing some configuration somewhere but i have no idea where!
Code: Select all
sudo /bin/bash -c "echo ds1374 0x68 > /sys/class/i2c-adapter/i2c-1/new_device"Code: Select all
/bin/bash -c "echo ds1374 0x68 > /sys/class/i2c-adapter/i2c-1/new_device"
# Check for an IP address
_IP=$(hostname -I) || true
_HOSTNAME=$(hostname) || true
if [ "$_IP" ]; then
# We have a network, set the hwclock from the system time.
printf "\nSetting hardware clock from system time\n"
/sbin/hwclock -wu
printf "\n%s IP address is %s\n" "$_HOSTNAME" "$_IP"
else
# No network, set the system time from the hw clock
printf "\nSetting system time from hardware clock\n"
/sbin/hwclock -s
fi
So if we use the serial connection, we can expect battery drain. There's a post above about draining a battery by running it overnight. That seems pretty crazy to me. Certainly there's no point in having a battery-backed RTC if the battery needs to be changed every day!4.6 Battery Drain
If a battery is present and the power of the Raspberry-Pi is switched of the Atmega-48 will still
remain powered by the Battery. It will also keep running. Unless the battery is removed or the
Atmega-48 is programmed to go into a special ultra-low-power condition, the battery will be
drained in a short time.
Even if you think the device is in ultra-low-power mode it can still consume power if it has to
drive outputs high.
Measurements have also show that if a UART connection exists between the Atmega-48 to the
Raspberry-Pi (even if it is not used) that increases the lower power current from 1μA to about
100μA.
Serial connection to the Pi from the 48p is not needed at all.declanmalone wrote:Hi,
I've read this thread and also the section of the 'duino manual:
So if we use the serial connection, we can expect battery drain. There's a post above about draining a battery by running it overnight. That seems pretty crazy to me. Certainly there's no point in having a battery-backed RTC if the battery needs to be changed every day!4.6 Battery Drain
If a battery is present and the power of the Raspberry-Pi is switched of the Atmega-48 will still
remain powered by the Battery. It will also keep running. Unless the battery is removed or the
Atmega-48 is programmed to go into a special ultra-low-power condition, the battery will be
drained in a short time.
Even if you think the device is in ultra-low-power mode it can still consume power if it has to
drive outputs high.
Measurements have also show that if a UART connection exists between the Atmega-48 to the
Raspberry-Pi (even if it is not used) that increases the lower power current from 1μA to about
100μA.
Just to clarify things, I'd like to know whether a serial connection to the Pi is needed if we want to run the RTC program on the 48p and have it communicate the time back to the Pi. This is really confusing for me because (a) if we do have to use serial, then the battery drain issue makes the RTC pointless, and (b) if we're not using the serial, then how does the 48p communicate the time back to the Pi?
The CR1025 batteries are not cheap, and I'd rather not waste any on a setup that's going to run it down in short order, so if I could get clarification on this before I start setting up it would be much appreciated. Thanks
It's not as simple as that.sanist wrote:Thanks for this valuable info.
What about making use of the RTC within the arduino environment: is it as simple as making use of DS1374RTC libraries?