- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi All
I found the NAK Signal During the write frame.
I have attached the logic analyzer observation result for the same.
Master Device:- PIC Controller
Slave Device :- Cy8C4025AZI-S413
My Slave Address is 0x08
Ideally After Address byte their should be ACK From Slave but I observed NAK Signal.
I am not getting where is the exact mistake?
Any help will be highly appreciated.
Regards,
AsDh
Please Find the below Code for reference..
#include <project.h>
/* Macro Declaration */
#define BUFFER_SIZE (1u)
#define PACKET_SIZE (BUFFER_SIZE)
/* The I2C Slave read and write buffers */
uint8 i2cReadBuffer [BUFFER_SIZE] = {0};
uint8 i2cWriteBuffer[BUFFER_SIZE]= {0};
uint8_t flag1=0;
uint8_t flag3=0;
void Received_Data_From_Master1();
int main()
{
/* Eneble Global Interrupt */
CyGlobalIntEnable;
CapSense_Start();
CapSense_ScanAllWidgets();
/* Start the I2C Slave And I2C Address Setting*/
I2CS_I2CSlaveInitReadBuf(i2cReadBuffer, BUFFER_SIZE);
I2CS_I2CSlaveInitWriteBuf(i2cWriteBuffer, BUFFER_SIZE);
I2CS_I2CSlaveSetAddress(0x08);
I2CS_Start();
for (;;)
{
//CyDelay(2);
/* With Respect to Master i.e Checked Whether the Master Write Complted Or Not */
if (0u != (I2CS_I2CSlaveStatus() & I2CS_I2C_SSTAT_WR_CMPLT))
{
/* Calling Function to Collect The Data From Master */
Received_Data_From_Master1();
/* Enable this above function when we used the data On Switch Function */
/* Clear the slave write buffer and status */
I2CS_I2CSlaveClearWriteBuf();
(void) I2CS_I2CSlaveClearWriteStatus();
}
if (0u != (I2CS_I2CSlaveStatus() & I2CS_I2C_SSTAT_RD_CMPLT))
{
/* Clear the slave read buffer and status */
I2CS_I2CSlaveClearReadBuf();
(void) I2CS_I2CSlaveClearReadStatus();
}
if(CapSense_NOT_BUSY == CapSense_IsBusy())
{
/* API For Capsense Update Scanning And Process */
CapSense_ProcessAllWidgets(); /* Process all widgets */
CapSense_RunTuner(); /* To sync with Tuner application */
/* Checked whether Left Button Active or Not*/
if((flag3==0)&&(CapSense_IsWidgetActive(CapSense_BUTTON2_WDGT_ID)) )
{
POWER_LED_Write(0);
flag3=1; /* Reseting Left Button Flag */
i2cReadBuffer[0] = 0x01;
// while (I2CS_I2C_SSTAT_RD_CMPLT!=(I2CS_I2CSlaveStatus()));
// /* Clear the slave read buffer and status */
// I2CS_I2CSlaveClearReadBuf();
// (void) I2CS_I2CSlaveClearReadStatus();
//i2cReadBuffer[0] = 0xFF;
}
else if((flag3==1) && (!(CapSense_IsWidgetActive(CapSense_BUTTON2_WDGT_ID))))
{
flag3=0; /* Setting Left Button Flag */
i2cReadBuffer[0] = 0xFF;
}
/* Checking Right Button active or not */
if((flag1==0)&&(CapSense_IsWidgetActive(CapSense_BUTTON0_WDGT_ID)))
{
flag1=1; /* Reseting the flag*/
i2cReadBuffer[0] = 0x06;
// while (I2CS_I2C_SSTAT_RD_CMPLT!=(I2CS_I2CSlaveStatus()));
// /* Clear the slave read buffer and status */
// I2CS_I2CSlaveClearReadBuf();
// ( void) I2CS_I2CSlaveClearReadStatus();
i2cReadBuffer[0] = 0xFF;
}
else if((flag1==1)&& (!(CapSense_IsWidgetActive(CapSense_BUTTON0_WDGT_ID))))
{
flag1=0;
}
CapSense_ScanAllWidgets();
}
}
}
void Received_Data_From_Master1()
{
switch(i2cWriteBuffer[0])
{
/* After Receiving 00 touch will be Ready to Work */
case 0x00:
i2cReadBuffer[0] = 0x19; /*According to New Document Wants to transmit new data acknowledgement */
POWER_LED_Write(0);
break;
}
}
/* [] END OF FILE */
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @AsDh_4015406 ,
Can you please let us know the sequence of steps . commands you are issuing from the master end?
Can you also please share the PSoC Creator project so that we can debug the issue at our end?
Can you check the slave device using Bridge Control Panel or other I2C master emulator such as Aadvark and check if the issue is reproducible?
Bragadeesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @AsDh_4015406 ,
We are locking this thread due to inactivity for more than three weeks. Please start a new discussion in case you have further questions.
Bragadeesh