Hello everyone,
I am trying to establish I2C communication between 2 microcontrollers. My colleague operates PIC32 as I2C master device and my job is to program ESP32S3 as I2C slave device. In my opinion our problem is synchronization but actually I have no clue. We both have written our codes separately and tested them out. I have recreated I2C communication scenario with ESP32S3WROOM-1 chip(slave) and ESP32DOITDEVKIT(master) and the slave device gets the bytes from the master device. I am providing logic diagram below(diagram1). My colleague has written an I2C application for LCD and it works fine, but when the same code is applied to our application(PIC32->ESP32S3) logic diagram does not seem fine to me. I am providing logic diagram below(diagram2) which represents PIC32->ESP32S3 I2C communication. Note, that after NACK data byte is still sent and because no ACK bite is sent, SCL keeps the low state. I am also adding my I2C slave code which works in my personal I2C simulation scenario. Maybe you guys can point out flaws in my code.
I2C acknowledge bit not sent.
I2C acknowledge bit not sent.
- Attachments
-
- i2c_slave_code.txt
- (3.84 KiB) Downloaded 164 times
-
- diagram1.png (89.05 KiB) Viewed 1287 times
-
- diagram2.png (63.75 KiB) Viewed 1287 times
-
- Posts: 1710
- Joined: Mon Oct 17, 2022 7:38 pm
- Location: Europe, Germany
Re: I2C acknowledge bit not sent.
Not specific to the I2C communication, but in your code
1. you try to read up to 20 bytes into a buffer of 2 bytes.
2. you create the queue in one task while another task is supposed to read from it, and you create a new queue in each iteration (without ever deleting it...)
1. you try to read up to 20 bytes into a buffer of 2 bytes.
2. you create the queue in one task while another task is supposed to read from it, and you create a new queue in each iteration (without ever deleting it...)
Who is online
Users browsing this forum: Bing [Bot] and 76 guests