Hi
I bought some PCF8523 BreakoutBoards to be used as RTC and also to generate interrupt pulses with the TimerA function of the PCF8523.
- I installed the PCF8523 as describied on the adafruit learning pages. All went well and the RTC is working OK.
- Now for the second requirement:
I want to use the TimerA function of the chip to generate a clock with about 10 ms period so that I can connect the SQW board output to a Raspberry input and thereby generate an interrupt every 10ms.
Therefore I installed the Python3-smbus library to set the necessary registers in the PCF8523 chip. Now this Python code:
import smbus
address = 0x68
PCF8523= smbus.SMBus(1)
PCF8523.write_byte_data(address,0x0f,0x9A)
PCF8523.write_byte_data(address,0x10,0x11)
PCF8523.write_byte_data(address,0x11,0x0A)
Result is: "OSError: [Errno 16] Device or resource busy" right at the first write.
It seams the driver is blocking the PCF8523 chip.
How can I set the registers 0x0f,0x10 and 0x11 the make the PCF8523 generate an pulse on it's INT1-line (SQW on the board) other than the default 32kHz clock (i need about 100 Hz).
Can I somehow add initializing code to the driver? Is there a way to overcome the OSError: [Errno 16] Device or resource busy in PyThon?
Thank you in advence for your support and
best regards
Thomas
Raspberry Python 3.4 and adafruit PCF8523 Module
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_carter
- Posts: 29483
- Joined: Tue Nov 29, 2016 2:45 pm
Re: Raspberry Python 3.4 and adafruit PCF8523 Module
That's the issue. It can't do both. If you've set it up to be an RTC for the Pi via a kernel driver, then you can't access it ad hoc from other programs. So you would have to disable/remove the kernel driver and then it becomes just another device sitting on the I2C bus that you can access and talk to.It seams the driver is blocking the PCF8523 chip.
Or, to do both, support would need to be added to the kernel driver.
- tjf
- Posts: 6
- Joined: Mon Sep 04, 2017 6:12 pm
Re: Raspberry Python 3.4 and adafruit PCF8523 Module
Hmmm...
Thanks for the rply.
Best regards
Thomas
Thanks for the rply.
Best regards
Thomas
Please be positive and constructive with your questions and comments.