- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear All:
I am working with a design requiring a digital potentiometer, in this case the MCP4661 from Microchip. Please find attached datasheet of this chip.
To test the potentiometer, I am using CY8CKIT-050 and the Evaluation kit of the potentiometer. See attached, the User Guide of the Evaluation kit of MCP4661 and a photo of the assembly I am using to test it.
I just want to write and read from register of the MCP4661. Write, to set the resistor and read to know the actual value.
I have developed two functions (see attached project) to write and read:
void mcpWrite(uint8 chipAddress, uint8 Register, uint8 Value);
uint16 mcpRead(uint8 chipAddress, uint8 Register);
I have a problem on both functions. When I write with I2CM_MasterWriteBuf, and then, wait until transfer complete with (see line 77, on MCP4661_I2C.c):
if (0u != (I2CM_MasterStatus() & I2CM_MSTAT_WR_CMPLT)),
It never ends, stay in this loop forever.
On the other hand, I2CM_MasterWriteBuf, return I2C_MSTR_NOT_READY
Can anyone give a hand and tell me why I am no able to communicate with MCP4661? Any idea? Any comment will be welcome.
Please find attached also the Evaluation kit schematic that I am using (hand-drawn). The kit is populated with MCP4661 by default, that I want to use.
Attached also the project I am using to test it.
Thanks in adavance,
Joaquin.
Solved! Go to Solution.
- Labels:
-
PSoC 5LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I've just briefly saw your main.c.
I would recommend you to call
I2CM_Start() ;
just after
CyGlobalIntEnable ;
===================
int main(void)
{
uint16 temp;
/* The LCD will help us to debug application */
LCD_Char_Start();
LCD_Char_PrintString("Test MCP46461");
CyGlobalIntEnable; /* Enable global interrupts. */
I2CM_Start() ;
/* Place your initialization/startup code here (e.g. MyInst_Start()) */
temp= mcpRead(mcpEVK, VW1);
LCD_Char_Position(1,0);
LCD_Char_PrintInt16(temp);
//mcpWrite(mcpEVK, VW1, 0);
//mcpWrite(mcpEVK, VW0, 0);
for(;;)
{
/* Place your application code here. */
}
}
===================
moto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I've just briefly saw your main.c.
I would recommend you to call
I2CM_Start() ;
just after
CyGlobalIntEnable ;
===================
int main(void)
{
uint16 temp;
/* The LCD will help us to debug application */
LCD_Char_Start();
LCD_Char_PrintString("Test MCP46461");
CyGlobalIntEnable; /* Enable global interrupts. */
I2CM_Start() ;
/* Place your initialization/startup code here (e.g. MyInst_Start()) */
temp= mcpRead(mcpEVK, VW1);
LCD_Char_Position(1,0);
LCD_Char_PrintInt16(temp);
//mcpWrite(mcpEVK, VW1, 0);
//mcpWrite(mcpEVK, VW0, 0);
for(;;)
{
/* Place your application code here. */
}
}
===================
moto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I also put CY8CKIT-059 sample of using I2C with LM75B in the discussion
CY8CKIT-059 I2C pins P12_0 and P12_1
I hope this could be a hint of using I2C with PSoC 5LP.
moto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Motoo Tanaka,
Thank you for your support.
You are right, I forgot to add I2CM_Start() ;
Sorry you lose you time...ohhhhhhhh! I couldnt see the problem after one day and half working with this!!!
Thanks again.
Joaquin.