thebolt commented on issue #10853: URL: https://github.com/apache/nuttx/issues/10853#issuecomment-1764166255
Sure. The defconfig is attached, and below is a code excerpt with the setup of the I2C message. It's part of our RTC driver which is not 100% ready to be publicly released, but the relevant part is: ``` #define CONFIG_RX8900_I2C_FREQUENCY 400000 #define RX8900_I2C_ADDRESS 0x32 #define RX8900_I2C_TRY_COUNT 4 #define RX8900_SEC 0x00 static int rx8900_read_regs(FAR struct rx8900_rtc_lowerhalf_s *priv, uint8_t reg, uint8_t count, uint8_t *values) { struct i2c_msg_s msg[2] = { 0 }; int try = RX8900_I2C_TRY_COUNT; int ret; msg[0].frequency = CONFIG_RX8900_I2C_FREQUENCY; msg[0].addr = RX8900_I2C_ADDRESS; msg[0].flags = I2C_M_NOSTOP; msg[0].buffer = ® msg[0].length = 1; msg[1].frequency = CONFIG_RX8900_I2C_FREQUENCY; msg[1].addr = RX8900_I2C_ADDRESS; msg[1].flags = I2C_M_READ; msg[1].buffer = values; msg[1].length = count; /* * There is a 61µs window during which the RTC does not acknowledge I2C * transfers. In that case, ensure that there are multiple attempts. */ do { ret = I2C_TRANSFER(priv->i2c, msg, 2); } while ((ret == -ENXIO || ret == -EIO) && --try); if (ret < 0) { rtcerr("ERROR: Failed to read registers: 0x%02x..0x%02x (err %d)\n", reg, reg + count, ret); return ret; } return OK; } void cat(void) { ... int ret = rx8900_read_regs(priv, RX8900_SEC, 7, date); ... } ``` [defconfig.txt](https://github.com/apache/nuttx/files/12915068/defconfig.txt) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org