- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I try to interface a AD5933 Chip on my PSoC 1 Evaluation Board, using the I2CHW-Module.
Now I want to read out the status register and display the value on my LCD.
It seems that the High-Level API doesn´t work very good (or I make some misstakes), so I use the low level API to realize the communication shown in the datasheet (http://www.analog.com/media/en/technical-documentation/data-sheets/AD5933.pdf).
But where is my misstake? It seems that the chip doesn´t send anything.
Thank you for help!
- Labels:
-
PSoC 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Edit: There are no start conditions in my C-File. I have fixed that, this project is an old version.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
And does your program run now as expected?
In the datasheet the I2C-address of AD5933 is shown as 0x0D (and not 0x06)
Bob
PS: Where in Germany are you located? I live near Bremen.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Bob,
thank you for your answer.
Have some missunderstanding i by reading the datasheet...
Thought the Address is 6 Bit + RW and not 7 Bit + RW. It looks little bit strange in the datasheet, because they only shown 6 Bit + RW in the Timing Diagram....just my oppinion
I´m from Monheim, between Cologne and Dusseldorf.
Thank you for an answer 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I´ve got the communication running.
Now I try to generate a 30kHz Sine, like in the datasheet. The Display show the right register values, but my scope doesn´t messure a sine wave.
If I understand the datasheet right, I have to write 0x10 to the high byte of the control register and fill the Frequencyregister with the frequency value (0x82 - 0x84).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I should think Analog Devices has example C code to run the part ? That
you could port to PSOC ?
The flow code chart in datasheet you have followed ?
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok now it works.
Do a simple measurement error....I connect my scope with the input and output of the voltage from the chip.
The scope impedance was too high. I use a 100k resistor now and now my scope measure the 2Vss sine wave.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Congratulations! The datasheets for I2C slaves are difficult to read very often. There are different ways to specify the address and only some documentators rely on an automatically inserted/appended R/W-bit as the Cypress components do.
Bob
PS: Ausbildung in Leverkusen, Studium in Jülich. I know that Monheim area...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here is a project just using PSOC to measure Z (PSOC 3 based) -
http://www.cypress.com/?app=forum&id=2492&rID=76890
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
OK next job is to start the sweep. I programm the diagramm from the datasheet, but the sweep doesn´t start.
I like this datasheet from analog. Only missunderstanding comes from the timing diagramm. But they explain all other very good.
Doesn´t read the datasheet very carefully, so I´ve got some problems 🙂
I´m on my way to finish my bachelor of engineering. Have done my education in Monheim 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Kampi,
I am also using AD5933 for impedance measurement, but I am using PSoC 5PL. Nevertheless I have some issues. I managed to measure the temperature with the AD5933 but currently I have no idea if I am right with my code.
#include <project.h>
#include "stdio.h"
//asm(".global _sacnf_float");
#define TRANSMIT_BUFFER_SIZE 80
#define BUFFER_SIZE (0x02u)
#define SLAVE_ADDR_SIZE (0x01u)
char TransmitBuffer[TRANSMIT_BUFFER_SIZE];
uint8 startfreq1[2]={0x82,0x0F}; //0x82=register address, second parameter are the first two hex-code letters of the start frequency
uint8 startfreq2[2]={0x83,0x5C};
uint8 startfreq3[2]={0x84,0x28};
//three arrays for the start frequency: 0x0F5C28
int main()
{
CyGlobalIntEnable; /* Enable global interrupts. */
UART_1_Start();
UART_1_PutString("\n Starting...");
I2C_Start(); //I2C initialisation
I2C_MasterWriteBuf(0x0Du, (uint8*) startfreq1, BUFFER_SIZE, I2C_MODE_COMPLETE_XFER); //0x0Du=slave adress
//(uint8*) buffer, I2C_MODE_COMPLETE_XFER=performing a complete transfer from start to stop
CyDelay(200);
I2C_MasterWriteBuf(0x0Du, (uint8*) startfreq2, BUFFER_SIZE, I2C_MODE_COMPLETE_XFER);
CyDelay(500);
I2C_MasterWriteBuf(0x0Du, (uint8*) startfreq3, BUFFER_SIZE, I2C_MODE_COMPLETE_XFER);
CyDelay(500);
if(!(I2C_MasterStatus() & I2C_MSTAT_XFER_INP))
{
I2C_MasterClearStatus();
I2C_MasterSendStop();
}
sprintf(TransmitBuffer,"Command1: %d,%d ",startfreq1[0],startfreq1[1]);
UART_1_PutString(TransmitBuffer);
UART_1_PutString(" Finished\n");
for(;;)
{
/* Place your application code here. */
}
}
Maybe you could help me out with your AD5933 experience. But I am also grateful for every other help.
Thanks in advance,
Alexander
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please do not provide us with code snippets, they are too difficult to check when there is no help from the IDE. Better is always to upload a complete archive. What I see at first sight is: You are sending
if(!(I2C_MasterStatus() & I2C_MSTAT_XFER_INP))
{
I2C_MasterClearStatus();
I2C_MasterSendStop();
}
That code will probably never get executed. What are your delays good for? required by datasheet? Can't you write all three frequency values at once? Isn't there in your device something like a write-pointer?
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The code
if(!(I2C_MasterStatus() & I2C_MSTAT_XFER_INP))
{
I2C_MasterClearStatus();
I2C_MasterSendStop();
}
is working. I used it for the temperature measurement which was fully working. It is just to make sure that there is no more data transfer in progress.
The delays were somehow necessary, without them the temp measurement with the AD5933 didnt work.
And now I tried to use my knowledge an my working could for the impedance measurenment.
It is written in the datasheet to split up the frequency hex-code and send the pieces to different adresses. I used the "I2C_MasterWriteBuf" like in my project before. There it worked.
PS: What do you exactly mean by uploading a whole archive? In which form should i upload my code?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Uploading an archive:
in Creator -> File -> Create Workspace Bundle(minimal)
in Designer -> File -> Archive Project...
then "Add Attachments" here in the forum with the resulting file.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Datashett page 28 shows detailled how to access your chip via I2C. Differs a bit from your approach. Have a look at the block-read and -write functions and the mentioned data pointer!
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi kampi (et al),
thanks for posting your code / project. i find it useful for getting my ad5933 going.
(was there an update since june that you are willing / able to share ? )
tcheuss, o