I2C Problem

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Not applicable
Hi everyone,

I´m new in DAVE projects and I have a problem to connect my NFC CLICK via i2c with MASTER_i2c APP. I Send the correct address and the ACK bit is 1. I dont understand why it dont respond.

Can you help me ??

#include                  //Declarations from DAVE Code Generation (includes SFR declaration)

/**

* @brief main() - Application entry point
*
* Details of function

* This routine is the application entry point. It is invoked by the device startup code. It is responsible for
* invoking the APP initialization dispatcher routine - DAVE_Init() and hosting the place-holder for user application
* code.
*/

#define SLAVE_ADDRESS (0x28)
#define SLAVE_ADDRESS_W (0x50)
#define SLAVE_ADDRESS_R (0x51)
#define max_size 258


uint8_t rx_buffer[max_size] = {0};
uint8_t mem_address[2];


volatile uint8_t tx_completion_0 = 0;
volatile uint8_t rx_completion_0 = 0;


/* Transmit callback handling */
void tx_callback_0(void)
{
tx_completion_0 = 1;
}


/* Receive callback handling */
void rx_callback_0(void)
{
rx_completion_0 = 1;
}


void delay(uint32_t counter)
{
volatile uint32_t cnt = counter;
while(--cnt);
}

void init_nfc(){
uint8_t CORE_RESET_CMD[] = { 0x20, 0x00, 0x01, 0x01 };
uint8_t CORE_INIT_CMD[] = { 0x20, 0x01, 0x00 };

I2C_MASTER_Transmit(&I2C_MASTER_0,true, SLAVE_ADDRESS_W,CORE_RESET_CMD, 4,false);
while(tx_completion_0 == 0);
tx_completion_0=0;

}

int main(void)
{
DAVE_STATUS_t status;

if(status != DAVE_STATUS_SUCCESS)
{
/* Placeholder for error handler code. The while loop below can be replaced with an user error handler. */
XMC_DEBUG("DAVE APPs initialization failed\n");
while(1U);
}

init_nfc();

/* Programa em loop oo */

while(1U){
}
return 0 ;
}




This is one photo of my oscilloscope, yellow is CLK , blue is SDA and green is a INT of NFC is one when it wants talk.




Thanks
0 Likes
0 Replies