TI ADS1298 via EB013 over SPI

For E-blocks user to discuss using E-blocks and programming for them.

Moderators: Benj, Mods

Post Reply
mb02155
Posts: 14
Joined: Thu Sep 02, 2010 11:49 pm

TI ADS1298 via EB013 over SPI

Post by mb02155 »

Hello,

I am trying to interface with the TI ADS1298 using the EB013 and am having some trouble. I am starting with the basics by attempting to read the ID Control register (as defined on page 42 of the datasheet http://focus.ti.com/lit/ds/symlink/ads1298.pdf). I am not getting anything back from the device. Here is what I am doing in my flowchart:

1) SPI_Init
2) Create Variable "bytetosend" and assign it to be 32 (0010 0000 binary - read register 0) First opcde - Page 40 of the datasheet
2) delay 10ms
3) SPI_SEND_CHAR bytetosend
4) delay 10ms
5) bytetosend=0 (0000 0000 binary - to read 1 register location) Second opcode - page 40 of the datasheet
6) SPI_SEND_CHAR bytetosend
7) Create variable "bytereceived"
8) SP_Get_Char bytereceived
9) delay 10ms
10) LCD_DISPLAY Start
11) delay 10ms
12) LCD_DISPLAY_PrintNumber bytereceived (expected output should be 2, but we don't get anything)

I have tried removing the delays and making them longer and still don't get anything back.

What am I doing wrong? Am I not doing something correctly with the SPI component?

Thank you!
Marty

User avatar
Dan81
Valued Contributor
Valued Contributor
Posts: 268
Joined: Sun Jan 15, 2006 4:07 pm
Location: Albi France
Been thanked: 60 times
Contact:

Re: TI ADS1298 via EB013 over SPI

Post by Dan81 »

Hello Marty

where do you manage the CS (chip select) ?

Daniel

mb02155
Posts: 14
Joined: Thu Sep 02, 2010 11:49 pm

Re: TI ADS1298 via EB013 over SPI

Post by mb02155 »

At the moment /CS is tied low.

Marty

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: TI ADS1298 via EB013 over SPI

Post by Benj »

Hello Marty,

This may be bad news to you but a lot of SPI devices actually need the CS line to begin high and then be pulled low to activate a kind of wake up interrupt. The flip side is that some SPI devices need the CS line to go back high to then process the received command. Therefore I would dig out the old soldering iron and attach the CS line to an I/O pin.

mb02155
Posts: 14
Joined: Thu Sep 02, 2010 11:49 pm

Re: TI ADS1298 via EB013 over SPI

Post by mb02155 »

Thanks for the reply.

I will reattach it to an i/o pin and try again. I will let you know if that makes a difference.


Marty

mb02155
Posts: 14
Joined: Thu Sep 02, 2010 11:49 pm

Re: TI ADS1298 via EB013 over SPI

Post by mb02155 »

Hello,

I am still stuck on this. I have the following connections between the ADS1298 and the PIC:

ADS1298 SCLK -> 18F4550 Pin 34 (SCLK)
ADS1298 SDI -> 18F4550 Pin 26 (SDO)
ADS1298 SDO -> 18F4550 Pin 33 (SDI)
ADS1298 /CS -> 18F4550 Pin 8 (RE0)
ADS1298 SPI Start -> 18F4550 Pin 9 (RE1)
ADS1298 Reset -> Pin 10 (RE2)
ADS1298 SPI DRDY -> Pin 35 (Int2)

I have attached the flowchart that I am using. Anyone got any suggestions on what I am doing wrong?

Thank you very much!!
Marty
Attachments
mb-usb-serial with SPI.fcf
Flowchart with USB and SPI
(15.5 KiB) Downloaded 401 times

mb02155
Posts: 14
Joined: Thu Sep 02, 2010 11:49 pm

Re: TI ADS1298 via EB013 over SPI

Post by mb02155 »

I am still stuck on making this work. I believe that things are working to read data via SPI, but I don't think it is sending characters. Is it possible I should use something other than the SPI_Legacy? What about SPI_SEND_CHAR - would that be correct? I have tried sending characters and bytes and nothing seems to work.

Any suggestions?

User avatar
Dan81
Valued Contributor
Valued Contributor
Posts: 268
Joined: Sun Jan 15, 2006 4:07 pm
Location: Albi France
Been thanked: 60 times
Contact:

Re: TI ADS1298 via EB013 over SPI

Post by Dan81 »

Hello Marty

Try the attached file, I've modified the "ADS1298Init" macro.
I'm not sure of my work, ADS1298 is a big component with lot of configuration.

Can you take a look on the SPI signals with an oscilloscope or a logic analyser ?

Good luck

Daniel
Attachments
mb-usb-serial with SPI_v2.fcf
(15.5 KiB) Downloaded 475 times

Spanish_dude
Posts: 594
Joined: Thu Sep 17, 2009 7:52 am
Location: Belgium
Has thanked: 63 times
Been thanked: 102 times

Re: TI ADS1298 via EB013 over SPI

Post by Spanish_dude »

Hi,
5) bytetosend=0 (0000 0000 binary - to read 1 register location) Second opcode - page 40 of the datasheet
OPCODE 2 seems to be 01h (0000 0001b) and not 00h.

Regards,

Nicolas Lopez F.

Post Reply