Hello all,
I'm trying to implement the TDC-GP22 Time-to-Digital Converter using an Arduino Uno. I used the code of leokoppel(GitHub - leokoppel/GP22: An Arduino library for the Acam GP22 Time-to-Digital Converter), and I followed what he says to put the GP22 into the Arduino library. The wiring between GP22 and Uno is also checked as the author mentioned in the code:
* Test setup (Arduino Uno, through 5->3.3V level shift)
* 10 -> SS
* 11 -> MOSI
* 12 -> MISO
* 13 -> SCK
* 2 -> INT
* 5V -> VCC
* GND -> GND
* 4 -> DS18B20 temperature sensor (optional)
Since the temperature sensor is optional , I didn't put it. I saw there is a 3.3V port on Uno so I use it directly.I don't know if it matters.
Besides, the GP22-DEMO-KIT is already connected to the 15-pin VGA connector so the wiring is in fact between Uno and VGA. I don't know neither if this will cause problem.
And one thing strange in the code, it has const bool DEBUG = 0; and Serial.begin(DEBUG ? 115200 : 1000000); which means the serails baud rate will be 1000000, right? And it doesn't work if I keep this value of DEBUG. So I change it to 1 and when I upload, error like this:
attached pinChangeISR_debug
/\Temp sensor: no addresses.
Starting up
/\/\/\/\/\/\/est took 820 us
Read/write test failed!
That means the test of reading data from register 5 failed. And I also tried to read other registers, but all I got is 0.
If I skip this step of testcommunication, I got the following:
attached pinChangeISR_debug
/\/Temp sensor: no addresses.
Starting up
\/\/\/\/\/\/
Register 0: 0x00041223
Register 1: 0x0141000f
Register 2: 0xa0000000
Register 3: 0x20000000
Register 4: 0x20000000
Register 5: 0x00000041
Register 6: 0x00200000
Calibrating...
attached pinChangeISR_debug
\/
Calibrating resonator. Theoretical: 1953.1250
\/\Resonator: 0.0000
Calibrating TDC.
Regular measurement (0): 0.0000
Status = 0x0
ALU pointer 0
Hits (ch1, ch2) = 0,0
Cal: -6
Corr: inf
Cal freq: inf
attached ISR at 0x33D
Calibration failed.
I don't know whether it is the problem of write registers or read registers, or even the both.
I put the documents' links as follow:
GP22 Datasheet
GP22-DEMO-KIT User Guide
Thanks in advance for any help!