cancel
Showing results for 
Search instead for 
Did you mean: 

XCP timeout error in MATLAB Simulink Discovery STM32F411VET

sanathhere
Associate III

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)

sanathhere_0-1693984658950.png

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.

10 REPLIES 10
sanathhere
Associate III

or should i connect it to PB7? it is the I2C1 RX terminal but not the SDA line for the sensor

Issamos
Lead II

Hello @sanathhere 

This post explain the serial communication between stm32 and MATLAB.

Best regards.

II

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?

 

image (1).png

image (2).png

image (3).png

 Your confirmation is highly appreciated. 

As we can see in the table5 that you attached, you should use PB6 and PB9.

Best regards

II

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?

@sanathhere 

The CS is for SPI configuration and note i2c.

Best regards.

II

Thank you so much, I will try what you suggested. Thanks again.

When your question is answered. Close the topic by choosing a best answer .

best regards.

II

sanathhere
Associate III

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?