2023-09-06 12:20 AM
Hi, I am trying to communicate and read values from the onboard LSM303AGR accelerometer from my STM32F411VET Discovery board in Simulink. I am using a USB TTL232 RPI cable for serial communication where the three pins are connected to GND, PB6 (SCL) and PB9(SDA)
I have used the correct COM port from the device manager however, I am not able to connect the model to my target hardware. I have the following error
"Error:External Mode Open Protocol Connect command failed Caused by: Could not connect to target application: XCP internal error: timeout expired, in response to XCP CONNECT command"
Could anyone confirm how to get serial communication working matlab for this board. I have not seen any solutions online and was hoping to get some help on the same.
Thank you.
2023-09-06 12:26 AM
or should i connect it to PB7? it is the I2C1 RX terminal but not the SDA line for the sensor
2023-09-06 12:30 AM
Hello @sanathhere
This post explain the serial communication between stm32 and MATLAB.
Best regards.
II
2023-09-06 12:37 AM
Hello,
Thank you so much for the response, I will try these setting with a fresh cube mx file, meanwhile are my connections on the board correct for the accelerometer? to PB6 and PB9 or it should be PB6 and PB7?
Your confirmation is highly appreciated.
2023-09-06 12:54 AM
As we can see in the table5 that you attached, you should use PB6 and PB9.
Best regards
II
2023-09-06 01:52 AM
Thank you, just one more question, there is also a chip select terminal but for me it is open right now. nothing is connected, but I am using the correct I2C1 addresses so do i need the CS terminal or it is correct without it also?
2023-09-06 02:15 AM - edited 2023-09-06 02:16 AM
2023-09-06 02:18 AM
Thank you so much, I will try what you suggested. Thanks again.
2023-09-06 02:23 AM
When your question is answered. Close the topic by choosing a best answer .
best regards.
II
2023-09-08 02:15 AM
Hello, I tried the serial communication through matlab once again but i still have the same error. When i connect my USB TTL Cable to PB6 and PB9. From a quick search, this is a USART error but I am not connected to USART1, but it is activated on the chip. I have selected SCL and SDA on PB6 and PB9 but there is also a USART communication on the same pin. Should i deactivate USART1 from CubeMX? Do I keep I2C1_SCL and I2C1_SDA on PB6 and PB9, or make it USART? when i try to connect my USB TTL to USART1 on PA9 and PA10, it is still the same error and also not the communication for LSM303AGR, What setting will work for serial communication on Matlab?