You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by gopalreddylakki February 19, 2024
//slavevoidrequestEvent()
{
Wire.write("hello\n"); // respond with message of 6 bytes// as expected by master
}
form the Arduino required 15 bytes, in the salve only having 6 bytes. in slave (stm32f103) after sending 6 bytes it's not the end transaction, it's in freezing.
but I check with another board manager stm32duino . it's working fine.
can check it and give me the solution
Slave program (STM32F103)
#include<Wire.h>
#defineI2C_ADDR0x09voidsetup()
{
Wire.begin(I2C_ADDR); // join i2c bus with address #4
Wire.onRequest(requestEvent); // register event
Wire.onReceive(receiveEvent); // register event
Serial.begin(115200); // start serial for outputpinMode(PC13,OUTPUT);
}
voidloop()
{
//empty loopdigitalWrite(PC13,HIGH);
delay(200);
digitalWrite(PC13,LOW);
delay(200);
}
// function that executes whenever data is received from master// this function is registered as an event, see setup()voidreceiveEvent(int howMany)
{
while(1 < Wire.available()) // loop through all but the last
{
char c = Wire.read(); // receive byte as a character
Serial.print(c); // print the character
}
// int x = Wire.read(); // receive byte as an integer//Serial.println(x); // print the integer
}
// function that executes whenever data is requested by master// this function is registered as an event, see setup()voidrequestEvent()
{
Wire.write("hello\n"); // respond with message of 6 bytes// as expected by master
}
Discussed in https://github.com/orgs/stm32duino/discussions/2279
Originally posted by gopalreddylakki February 19, 2024
![i2cs](https://private-user-images.githubusercontent.com/37047660/305740437-f1cd566d-4411-4899-a001-f423812cf301.PNG?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE3NTUxNTAsIm5iZiI6MTcyMTc1NDg1MCwicGF0aCI6Ii8zNzA0NzY2MC8zMDU3NDA0MzctZjFjZDU2NmQtNDQxMS00ODk5LWEwMDEtZjQyMzgxMmNmMzAxLlBORz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MjMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzIzVDE3MTQxMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWYwZmQxMmRjNDkzZDRlNTUxNzA2YTBlNTRhMTljOGEyOTNmNzdiN2IzM2RkYWVkMTllYjQ4NjQ1MTcwYTUzYzAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.amUuFwqO0WHWsFXsTMw1NlKT9iyktErwninR9bp-Zo4)
![Slave_STm32F103](https://private-user-images.githubusercontent.com/37047660/305740485-8b6bc0ee-2ce5-4085-a1a9-04945c65b357.PNG?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE3NTUxNTAsIm5iZiI6MTcyMTc1NDg1MCwicGF0aCI6Ii8zNzA0NzY2MC8zMDU3NDA0ODUtOGI2YmMwZWUtMmNlNS00MDg1LWExYTktMDQ5NDVjNjViMzU3LlBORz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MjMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzIzVDE3MTQxMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPThhOTkzZjVkN2U0ZTliMGNhNWMwNmQ0YzRmYzA3ODA2YTdkZGMyN2VjNDQ3NTE0ZjJjMzRjODE5NTU3ODgzZTkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.jHPdPfc9Cd1af5zF1hV8POh9-VfUyhpyF8SLr_jNk9E)
![Master_nano_read](https://private-user-images.githubusercontent.com/37047660/305740528-dc03a687-18be-4a28-b842-c3587bb3e491.PNG?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE3NTUxNTAsIm5iZiI6MTcyMTc1NDg1MCwicGF0aCI6Ii8zNzA0NzY2MC8zMDU3NDA1MjgtZGMwM2E2ODctMThiZS00YTI4LWI4NDItYzM1ODdiYjNlNDkxLlBORz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MjMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzIzVDE3MTQxMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWYwZDA3YTcwOGJjNjQ5NDcyOWI5ZGM2MTVhMjk0YzU0NGI2YTBiYTI2MzBjOTczNzQ5OWE5YTg4MTAwNTM5YjkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.WonDWG1DAnTuIQgqvNUcSkFSb-EYfSHRN-ugc0u1qxM)
form the Arduino required 15 bytes, in the salve only having 6 bytes. in slave (stm32f103) after sending 6 bytes it's not the end transaction, it's in freezing.
but I check with another board manager stm32duino . it's working fine.
can check it and give me the solution
Slave program (STM32F103)
master program (ardunio nano )
The text was updated successfully, but these errors were encountered: