-
No interrupt from AS6501...
Posted by
Denge
on 25 Apr, 2024 21:59
-
Hello All,
I'm struggling with a new design using the AS6501 chip. The nasty thing is I don't get an interrupt signal back from the chip after having started the measurement. I guess there is something wrong with the initial setup of the chip but the longer the more I'm getting lost.
My goal is to count the time distance between a start pulse on stopA and a stop pulse stopB.
The setup I use is as follows:
0b10010101 ; 0x95 CFG0: stop A&B active, LVDS disabled, REFCLK active, REFCLK index reset enabled
0b00010101 ; 0x15 CFG1: stop A&B processed, pulse distance, no high resolution
0xC0 ; CFG2: common & blockwise read
0xA0,0x86,0x01 ; CFG3,CFG4,CFG5 REFCLK_DIVISIONS (100000) for 10MHz refclk
0x00,0x00 ; CFG6,CFG7 LVDS pattern OFF
0xA1,0x13,0x00,0x0A,0xCC,0xCC,0xF1,0x7D ; CFG8 to CFG15 Fixed values
0x04 ; CFG16 CMOS level input
At my humble opinion this should be correct for an SPI only communication with this chip. The results I obtain for both channels (if I skip the interrupt) are for refIndxA and stopA 0x00FFFFFF and for refIndxB and stopB 0x00747474 regardless the pulse distance coming from an AFG. Anyone an idea what I did wrong here?
-
#1 Reply
Posted by
mino-fm
on 26 Apr, 2024 10:32
-
0xC0 ; CFG2: common & blockwise read
This is for LVDS output you don't use.
Let me show you an init sequence for both channels without PIN_ENA_RSTIDX.
const uint8_t AS6501_init_tab[] = {
0x15, // stop-A, stop-B und ext. REFCLK einschalten
0x85, // stop-A und stop-B auswerten, 1x Auswertung
0x00, // LVDS nicht aktiv
(uint8_t)(REFCLK_AUFLOESUNG), // LSB
(uint8_t)(REFCLK_AUFLOESUNG >> 8 ), // MSB-1
(uint8_t)(REFCLK_AUFLOESUNG >> 16), // MSB
0x00, // LVDS nicht aktiv
0x00, // dto.
0xa1, // interne Konstanten
0x13,
0x00,
0x0a,
0xcc,
0xcc,
0xf1,
0x7d, // bis hierhin
0x04 // CMOS-Pegel Eingänge
};
You always have to read out each FIFO to enable INTERRUPT again. They should be cleared after init.
-
#2 Reply
Posted by
Denge
on 26 Apr, 2024 15:21
-
Hello,
Thanks for the reply!
For CF2 the datasheet says that bits 6&7 are useful or SPI.
I copied your setup but without any succes for the interrupt pulse: the interrupt simply doesn't go low and I have still no idea why this is not happening!
The sequence I us is:
- write the config registers
- verify the setup
- initialise and start the measurement
- readout of measurement data
However, I never reach the read out as my program stalls on waiting for the interrupt.
The stopA and stopB pulses are generated with an AFG, so well defined.
Any idea why this interrupt is not going low?
Groeten.
-
#3 Reply
Posted by
dietert1
on 26 Apr, 2024 15:47
-
How did you check that your SPI communication works? Can you read back a known chip id or configuration register?
Today i spent two hours to find a design error concerning the enable signal of a TI DAC8554. That one doesn't support any read operation..
Regards, Dieter
-
#4 Reply
Posted by
mino-fm
on 26 Apr, 2024 16:50
-
Can you show your schematic?
-
#5 Reply
Posted by
Denge
on 27 Apr, 2024 15:24
-
Hi Both,
@ Dieter: the SPI is working correctly here as the config data I sent to the chip is read back and correspond to what I sent so I'm pretty sure the SPI communication is OK.
@ Mino: unfortunately the schematic is still a work in progress but it is very similar to yours (Pico-Fmeter-AS6501) around the AS6501 except for the 10Ω in the power lines and the 3K3 resistor in the interrupt line to the MCU. Plus I've only one 3V3 supply. I'm using a dsPIC33 processor but this shouldn't make any difference.
For the moment I'm testing (read: trying to get it running correctly) on a breadboard but this isn't the origin of the absence of the interrupt signal from the AS6501!
So I'm eager to receive a tip pointing me in the good direction to solve this.
-
#6 Reply
Posted by
dietert1
on 28 Apr, 2024 06:47
-
I downloaded their laser range finder app note from
https://downloads.sciosense.com/Files/ScioSense_AS6500_DMA_V1-package-1-3.zip. I successfully compiled the project for STM32L476 using CubeMX and EWARM - with all references resolved. So that's a good starting point. They capture the interrupt signal into a variable My_INTN_State and use that one to control the main application loop. A bit unusual is the use of both rising and falling edge for interrupt.
Regards, Dieter
-
#7 Reply
Posted by
Denge
on 29 Apr, 2024 06:56
-
Hi Dieter,
I did download it too. But I'm programming in assembler...
I'll try to compile it too in the hope I succeed :-)
Greetings
-
#8 Reply
Posted by
dietert1
on 29 Apr, 2024 07:41
-
The app note source codes are in C and C is portable. As a proof of concept you could port the app note to your MCU. Probably you have support for the peripherals needed (GPIO, Interrupt, SPI..)
Coding in assembler can be a second step once it works.
Regards, Dieter
-
#9 Reply
Posted by
Denge
on 29 Apr, 2024 14:26
-
Hi All,
Porting this code to the dsPIC33CK64MC105 MCU would take me ages I guess. On top of that I'm a novice in programming C.... So trying to port all this code would bring me further away than I'm now!
By now I checked and rechecked the hardware and found it should be ok, played with some different setups and added a 100 µs delay right after the power on reset and a 200 µs delay after the configuration write but still no interrupt going low! :-(
The config I use now is:
cfg0: 0x95, cfg1: #0x15, cfg2: #0x00, cfg3:4:5, 100000, cfg16, #0x04
The refclk is 10 MHz.
Conclusion: I'm lost
Greetings,
-
#10 Reply
Posted by
dietert1
on 29 Apr, 2024 16:22
-
Someone who wants to develop firmware with difficulties using C. Hm.
Today i found a laser range meter in our supermarket at € 17.90. They claim accuracy of 1.5 mm. At 15 cm/nsec time of flight this means a timing resolution of 10 psec. Having seen a unit price of € 27 for the AS6501 at digikey i thought: Is it possible there is a TDC inside and bought one. But nope. They implemented it with an ARM Cortex (GD32E230F6) and a Si5351A synthesizer. So it isn't single pulse detection but a phase measurement.
Regards, Dieter