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

XMC™ Forum Discussions

User21523
Level 1
Level 1
Welcome! First question asked
hi,

I have KIT_XMC11_BOOT_001 and try I2C using temperature sensor.
At first I would like to check I2C application's method is working correctly.

But it doesn't work, i mean when probe SDA, SCL there is no signal output.
and fall in loop line 44.

what i missed?


/*
* main.c
*
* Created on: 2021 Sep 29 14:27:58
* Author: A
*/




#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.
*/
uint8_t buffer[1] = {0x0B};
int main(void)
{
DAVE_STATUS_t status;

status = DAVE_Init(); /* Initialization of DAVE APPs */

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)
{

}
}

/* Placeholder for user application code. The while loop below can be replaced with user application code. */
while(1U)
{
I2C_MASTER_Transmit(&I2C_MASTER_0, true, 0x90, buffer, 1, true);
while(I2C_MASTER_IsTxBusy(&I2C_MASTER_0)) {};
}
}
0 Likes
1 Reply
Aashita_Raj
Moderator
Moderator
Moderator
100 solutions authored 250 replies posted 250 sign-ins
Hi @marq86,

Assuming that the code which you have shared is the entire main.c file here, there are a few points you need to check before I2C can be made to work -
1. Please try configuring the SDA and SCL pins as per the required I2C configuration such as their mode and output strength.
2. You need to set the Baud-rate for I2C transfer.
3. Select the appropriate input source channels of the USIC module, which will be configured as I2C.

We regret to inform that we presently do not have I2C code example, devised for XMC 1100 device but I have shared an image below from the xmc-4500 I2C_TRANSER code example which is a part of xmc-library. This image will help you understand the flow of code for the working of I2C.
5475.attach

Please go through this code example and the image so as to try at your end and let us know in case of any query.

Best Regards,
Aashita
0 Likes