LPC 4322 interface with AD7793 (24 bit resolution)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC 4322 interface with AD7793 (24 bit resolution)

665 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Elamkumaran on Thu Oct 10 07:16:25 MST 2013
[color=#03f]Hi,

We are using AD7793 SPI interface to connect with LPC4322 controller. LPC4322 act as a master. AD7793 has 24 bit data register. From LPC4322, we want to receive all the 24 bits. How we can do it? It will be of great help if you can able to tell with some example.[/color]
Labels (1)
0 Kudos
6 Replies

582 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Elamkumaran on Mon Oct 14 02:19:13 MST 2013
Thank You for the help. I did mean the SCLK.
0 Kudos

582 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by rocketdawg on Fri Oct 11 08:34:33 MST 2013

Quote: Elamkumaran
Thanks Martin for the detailed response. Based on my understanding here i have provided the sequence. Is my understanding correct?

Make slave select pin low using GPIO
Apply clock
Remove clock
I dont want to make GPIO select signal high since i need to read 24 bit continuously from the AD7793.



What do you mean "clock"?
if you are disabling the AD7793 internal clock and providing providing an external CLK then set up a timer or PWM to run this clock all the time (disable if going into sleep)
I don't think you mean that.

You do not need to do anything with SCLK.  placing data into the transmit register will automatically start the SCLK, to clock out&in the data.


you might want to reconsider leaving CS (chip select) high all the time.
setting it low when not in use protects the device from inadvertent writes or noise.
This device can only convert at max 470 Hz, if you continuously read, you will just be reading the same data over and over.
check out the DOUT/RDY pin.  You could wire that to both the SPI and another pin such as an extern interrupt pin.  Then you only read the device when a conversion is done.

0 Kudos

582 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Elamkumaran on Thu Oct 10 23:39:33 MST 2013
Thanks Martin for the detailed response. Based on my understanding here i have provided the sequence. Is my understanding correct?

Make slave select pin low using GPIO

Apply clock

Transmit dummy first 8 bit
Check SPIF & Read Status Register
Read Data Register

Transmit dummy second 8 bit
Check SPIF & Read Status Register
Read Data Register

Transmit dummy third 8 bit
Check SPIF & Read Status Register
Read Data Register

Remove clock

I dont want to make GPIO select signal high since i need to read 24 bit continuously from the AD7793.
0 Kudos

582 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by capiman on Thu Oct 10 08:06:19 MST 2013
Hi Elam,
just read 3 times 8 bits. Even when AD7793 (which i don't know) transmits 24 bits in one shot, the LPC will receive 3 times 8 bits in one shot.
Master creates the clock signal. There is no "framing" signal, which say that resulting data is really 24 bits or 3 times 8 bits.
Pay attention: The CS will be changed on start of command and CS goes back to idle at end of command.
What data is exchanged between, is not really relevant.
I have e.g. a SD card which sends me 512 bytes (1 sector full of data). I can read 512 times 8 bit. Or i can read 256 times 16 bits.
There are so many SPI devices, some use e.g. multiple fields, one after the another. LPC can't have each combination in hardware.
They only support certain transfer sizes and when you need more, you must just use multiple read/writes.
Pay attention that only when you send one byte, you will receive one byte.
If you want only read something from slave, you must send the same amount of dummy bytes.
Each sent byte will be producing x clock cycles on SPI. When you sent 1 bit, at the same time you receive 1 bit.
Best regards,
Martin
0 Kudos

582 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Elamkumaran on Thu Oct 10 07:31:01 MST 2013
Hi Martin,
Thanks for the reply. AD7793 transmit 24 bit in one shot. It will not transmit 3 times 8 bit data. So, in my controller i need to read all the 24 bits in one shot. Is there anyway in software i can control?

Tahnks in advance

Elam
0 Kudos

582 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by capiman on Thu Oct 10 07:21:07 MST 2013
Hi,
why not just use 3 times 8 bit reads? Or 2 times 12 bit reads?
Best regards,
Martin
0 Kudos