Problems connecting to i2c

Hello everyone! I am trying to understand the intricacies of various interfaces using the Arduino Uno R4 board. And I had problems connecting the bmp280 temperature and pressure sensor. I connected it via i2c, connected ground to ground, Vin to 3v3, sda/scl to pins a4/a5(P100/P101), and also connected the inputs to 3v3 via external 10kOhm resistors. Checking via Arduino IDE showed that the chip address is 0x76. When running a simple program via Arduino IDE, the data was transmitted and output to the serial monitor. I created a project using e2 studio. I connected an LCD screen to display information, configured the i2c master, the settings are shown below. I was constantly given an error: I2C Error: 0x08. I decided to check with an oscilloscope and saw that instead of the expected operation at the moment of processing the function

R_IIC_MASTER_Write(&g_i2c_master0_ctrl, &reg, 1, false);

both lines sda/scl simply went from 1 to 0 and did not change anymore. At the same time, when running the program in the Arduino IDE, everything works correctly and it is clear that the data is transmitted. I had suspicions that this is related to a technical blocking, for example, the esp32 chip, but I could not see anything suspicious on the diagram. Maybe someone has an idea what the problem is? The 1st picture of the oscilloscope shows the operation of my program, after passing the Write function, the lines go to 0. The second picture shows an example of the Arduino IDE program.
BMP Datasheet
Arduino Uno R4 Wi-Fi Schematic
Arduino Uno R4 Wi-Fi Datasheet

hal_entry.c:

#include "hal_data.h"
#include <stdio.h>

#define BMP280_REG_CHIP_ID     (0xD0)

FSP_CPP_HEADER
void R_BSP_WarmStart(bsp_warm_start_event_t event);
FSP_CPP_FOOTER

/*******************************************************************************************************************//**
 * main() is generated by the RA Configuration editor and is used to generate threads if an RTOS is used.  This function
 * is called by main() when no RTOS is used.
 **********************************************************************************************************************/

// Parameters

void LCD_EnablePulse(void);
void LCD_SendNibble(uint8_t nibble);
void LCD_Send(uint8_t value, uint8_t mode);
void LCD_Init(void);
void LCD_SetCursor(uint8_t col, uint8_t row);
void LCD_Print(const char *str);
void LCD_Clear(void);



fsp_err_t bmp280_read(uint8_t reg, uint8_t * data, uint32_t length);
fsp_err_t BMP280_ReadCalibration(void);
float BMP280_CompensateTemperature(int32_t adc_T);
float BMP280_ReadTemperature(void);



typedef struct {
    uint16_t dig_T1;
    int16_t  dig_T2;
    int16_t  dig_T3;
} bmp280_calib_t;

bmp280_calib_t bmp280_calib;
int32_t t_fine = 0;

// LCD



void LCD_EnablePulse(void)
{
    R_IOPORT_PinWrite(&g_ioport_ctrl, PIN_E, BSP_IO_LEVEL_HIGH);
    R_BSP_SoftwareDelay(1, BSP_DELAY_UNITS_MICROSECONDS);
    R_IOPORT_PinWrite(&g_ioport_ctrl, PIN_E, BSP_IO_LEVEL_LOW);
    R_BSP_SoftwareDelay(100, BSP_DELAY_UNITS_MICROSECONDS);
}

void LCD_SendNibble(uint8_t nibble)
{
    R_IOPORT_PinWrite(&g_ioport_ctrl, PIN_D4, (nibble >> 0) & 0x01);
    R_IOPORT_PinWrite(&g_ioport_ctrl, PIN_D5, (nibble >> 1) & 0x01);
    R_IOPORT_PinWrite(&g_ioport_ctrl, PIN_D6, (nibble >> 2) & 0x01);
    R_IOPORT_PinWrite(&g_ioport_ctrl, PIN_D7, (nibble >> 3) & 0x01);
    LCD_EnablePulse();
}

void LCD_Send(uint8_t value, uint8_t mode)
{
    R_IOPORT_PinWrite(&g_ioport_ctrl, PIN_RS, mode);
    LCD_SendNibble(value >> 4);
    LCD_SendNibble(value & 0x0F);
    R_BSP_SoftwareDelay(40, BSP_DELAY_UNITS_MICROSECONDS);
}

void LCD_Init(void)
{
    R_BSP_SoftwareDelay(50, BSP_DELAY_UNITS_MILLISECONDS);

    LCD_SendNibble(0x03);
    R_BSP_SoftwareDelay(5, BSP_DELAY_UNITS_MILLISECONDS);
    LCD_SendNibble(0x03);
    R_BSP_SoftwareDelay(150, BSP_DELAY_UNITS_MICROSECONDS);
    LCD_SendNibble(0x03);
    R_BSP_SoftwareDelay(150, BSP_DELAY_UNITS_MICROSECONDS);
    LCD_SendNibble(0x02);

    LCD_Send(0x28, 0);
    LCD_Send(0x0C, 0);
    LCD_Send(0x01, 0);
    R_BSP_SoftwareDelay(2, BSP_DELAY_UNITS_MILLISECONDS);
    LCD_Send(0x06, 0);
}

void LCD_SetCursor(uint8_t col, uint8_t row)
{
    uint8_t address;
    if (row == 0)
    {
        address = 0x80 + col;
    }
    else if (row == 1)
    {
        address = 0xC0 + col;
    }
    else
    {
        address = 0x80 + col;
    }
    LCD_Send(address, 0);
}

void LCD_Print(const char *str)
{
    while(*str)
    {
        LCD_Send((uint8_t)*str++, 1);
    }
}

void LCD_Clear(void)
{
    LCD_Send(0x01, 0);
    R_BSP_SoftwareDelay(2, BSP_DELAY_UNITS_MILLISECONDS);
}

// BMP



fsp_err_t bmp280_read(uint8_t reg, uint8_t * data, uint32_t length)
{
    fsp_err_t err;

    err = R_IIC_MASTER_Write(&g_i2c_master0_ctrl, &reg, 1, false);
    if (FSP_SUCCESS != err)
    {
         return err;
    }
    R_BSP_SoftwareDelay(10, BSP_DELAY_UNITS_MILLISECONDS);

    err = R_IIC_MASTER_Read(&g_i2c_master0_ctrl, data, length, true);

    return err;
}

fsp_err_t BMP280_ReadCalibration(void)
{
    uint8_t calib[6];
    fsp_err_t err = bmp280_read(0x88, calib, 6);
    if (FSP_SUCCESS != err)
    {
        return err;
    }
    bmp280_calib.dig_T1 = (uint16_t)calib[0] | ((uint16_t)calib[1] << 8);
    bmp280_calib.dig_T2 = (int16_t)calib[2] | ((int16_t)calib[3] << 8);
    bmp280_calib.dig_T3 = (int16_t)calib[4] | ((int16_t)calib[5] << 8);
    return FSP_SUCCESS;
}

float BMP280_CompensateTemperature(int32_t adc_T)
{
    int32_t var1, var2, T;
    var1 = ((((adc_T >> 3) - ((int32_t)bmp280_calib.dig_T1 << 1))) * ((int32_t)bmp280_calib.dig_T2)) >> 11;
    var2 = (((((adc_T >> 4) - ((int32_t)bmp280_calib.dig_T1)) * ((adc_T >> 4) - ((int32_t)bmp280_calib.dig_T1))) >> 12) * ((int32_t)bmp280_calib.dig_T3)) >> 14;
    t_fine = var1 + var2;
    T = (t_fine * 5 + 128) >> 8;
    return ((float)T) / 100.0f;
}

float BMP280_ReadTemperature(void)
{
    uint8_t data[3];
    fsp_err_t err = bmp280_read(0xFA, data, 3);
    if (FSP_SUCCESS != err)
    {
        return -9999.0f;
    }
    int32_t adc_T = ((int32_t)data[0] << 12) | ((int32_t)data[1] << 4) | ((int32_t)data[2] >> 4);
    return BMP280_CompensateTemperature(adc_T);
}

// Main

void hal_entry(void)
{
    fsp_err_t err;
    uint8_t chip_id = 0;
    char buf[32];

    LCD_Init();
    LCD_Clear();


    err = R_IIC_MASTER_Open(&g_i2c_master0_ctrl, &g_i2c_master0_cfg);
    if (FSP_SUCCESS != err)
    {
        char errMsg[32];
        sprintf(errMsg, "Open Err:0x%02X", err);
        LCD_SetCursor(0, 0);
        LCD_Print(errMsg);
        while(1);
    }

    err = bmp280_read(BMP280_REG_CHIP_ID, &chip_id, 1);
    if (FSP_SUCCESS == err)
    {
         sprintf(buf, "BMP280 ID: 0x%02X", chip_id);
         LCD_SetCursor(0, 0);
         LCD_Print(buf);
    }
    else
    {
        char errMsg[32];
        sprintf(errMsg, "I2C Error: 0x%02X", err);
        LCD_SetCursor(0, 0);
        LCD_Print(errMsg);
        while(1);
    }

    err = BMP280_ReadCalibration();
    if (FSP_SUCCESS != err)
    {
         LCD_SetCursor(0, 0);
         LCD_Print("Calib error");
         while(1);
    }

    while(1)
    {
        // R_IOPORT_PinWrite(&g_ioport_ctrl, LED_PIN, BSP_IO_LEVEL_HIGH);
        // R_IOPORT_PinWrite(&g_ioport_ctrl, LED_EXTERNAL, BSP_IO_LEVEL_HIGH);


        // R_BSP_SoftwareDelay(5000, BSP_DELAY_UNITS_MILLISECONDS);

        // R_IOPORT_PinWrite(&g_ioport_ctrl, LED_PIN, BSP_IO_LEVEL_LOW);
        // R_IOPORT_PinWrite(&g_ioport_ctrl, LED_EXTERNAL, BSP_IO_LEVEL_LOW);

        // R_BSP_SoftwareDelay(1000, BSP_DELAY_UNITS_MILLISECONDS);

        float temperature = BMP280_ReadTemperature();
            sprintf(buf, "T: %.2f C", temperature);
            LCD_Clear();
            LCD_SetCursor(0, 0);
            LCD_Print(buf);
            R_BSP_SoftwareDelay(1000, BSP_DELAY_UNITS_MILLISECONDS);
    }

#if BSP_TZ_SECURE_BUILD
    /* Enter non-secure code */
    R_BSP_NonSecureEnter();
#endif
}





Is that healthy?

I didn't quite understand what you mean

A diagram of how you connected the boards would be really helpful here. A description and photos just doesn't do it - there are wires that block the view of the wiring if you understand what I'm getting at. :upside_down_face:

Thank you, that helps a lot. If it matters, I don't know, but are BMP280 and BME280 practically the same?

One thing that strikes me is the pullup resistors R1, R2 @ 10 k, what made you pick that value? Try 4k7 or near.

The BMx280 have two V supply, Vdd and Vddio. Are not both needed or can you omit one? Also there are no bypass capacitors for the 280, see what the datasheet recommends and add.

It seem like the problem has to do with the code generated by e2 studio.
Maybe you should post your questions on an e2 studio forum