I wanted to try to interface the pcf7991at with arduino, I assembled the pcb containing the pcf7991at following the diagram shown in the datasheet. I saw that a frequency of 125khz must go on the CLK pin of the pcf, so I ask you if it is possible to use an internal arduino timer to try to see if the pcf7991at works.
2 Answers
The communication between MCU (Arduino) and IC (PCF7991AT) can work at any frequency (like SPI or I2C). The 125khz antenna frequency is generated in the IC internally. But you need to set the divider of the clock source (your crystal hooked up to the IC)
https://datasheet.lcsc.com/lcsc/2208260930_NXP-Semicon-PCF7991AT-1081-M_C5143533.pdf
See page 7 -> 8.4 short explanation page 13 -> to set the register
Hope this helps!
The Arduino is indeed capable of generating a 125kHz signal. This example generates a 125kHz signal (50% duty cycle) on digital pin 3 of an Arduino Uno/Nano using Timer 2.
const int pulsePin = 3; // note OC2B Pin D3 ! ! !
volatile uint32_t pulseCount = 0;
void setup(){
pinMode(pulsePin, OUTPUT);
cli() ;
TCCR2A = 0;
TCCR2B = 0;
TCNT2 = 0;
OCR2A = 127 ; // f = 125kHz @16MHz clock
OCR2B = (float) OCR2A * 0.5 ;
TCCR2A |= (1 << WGM21) | (1 << WGM20) | (1 << COM2B1 ) ; // Mode 7 (fast PWM )
TCCR2B |= (1 << CS20) | (1 << WGM22) ; // ps /1 mode 7
sei() ;
}
void loop() {
}
-
and how i check rising of the timer?, i need to read a particular register to see if timer is rised and eventually set to 0 after? Commented May 12, 2023 at 15:07