2025-06-03 12:29 AM
Hey friends,
Until yesterday, my custom board with the STM32H753ZI100_24 MCU—connected to an IMU sensor, magnetometer, and barometric sensor via SPI—was detected successfully by STM32CubeIDE. But today, when I came to the office, I’m unable to initialize the ST-Link device, which I used to program the board through Vaap, GND, SDIO and SWCLK pins in the st-link.
Here are the steps I’ve tried so far:
Restarted my Linux PC
Removed all power from the board and the ST-Link V2, checked the connection and then reconnected everything
Connected the ST-Link to another STM32 MCU on the same board, and it works fine
Verified 3.2 V power supply to the MCU with a multimeter which is needed for mcu to power up.
Despite this, I still can’t get the ST-Link to detect the board. Could this be caused by something in the last code I flashed, or is it likely a hardware issue?
Any advice or suggestions would be greatly appreciated!
Thanks in advance.
Solved! Go to Solution.
2025-06-09 5:53 AM
yeah fine, but in this post i replied that i got solved. but with in few hours i have the same issue and i edited the reply. but no one noticed it. thats why rather than reminding the visitors in the old post they may not even notice. i posted a new one so that new one will be viewed at the top. (as of my assumption)
2025-06-09 5:56 AM
@santhosh16 wrote:
but with in few hours i have the same issue and i edited the reply. but no one noticed it.
In next time post another comment instead of editing the post, so others can receive the notification.
Thank you.
2025-06-09 6:00 AM
oh fine, i don't know that you'll get notification when i reply to me in this post. i will try to reply in the same post again.
2025-06-09 7:49 AM
as a recent update my board got connected to the cubeprogrammer as said in this stackoverflow forum in 2nd point of just reducing the swd frequency to lesser than 4000 khz i.e. 480 khz. Now after connected, it is even got connected in 4000 khz also. now i will share my code to you to read the barometer sensor i have coded the below one. is this anything affects my hardware which goes to chip id as 0x0000
This is the main code
int main(void)
{
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MPU Configuration--------------------------------------------------------*/
MPU_Config();
/* MCU Configuration--------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* USER CODE BEGIN Init */
/* USER CODE END Init */
/* Configure the system clock */
SystemClock_Config();
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_SPI1_Init();
/* USER CODE BEGIN 2 */
HAL_GPIO_WritePin(GPIOD, GPIO_PIN_13, GPIO_PIN_RESET);
uint16_t prom[8] = {0};
uint8_t rst_cmd = 0x1E; // Reset command
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_4, GPIO_PIN_RESET);
HAL_SPI_Transmit(&hspi1, &rst_cmd, 1, HAL_MAX_DELAY);
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_4, GPIO_PIN_SET);
HAL_Delay(30000);
// if (MS5611_ReadPROM(prom) == HAL_OK) {
// // Now prom[] contains all PROM coefficients including factory data and CRC
// for (int i = 0; i < 8; i++) {
// printf("PROM[%d] = %u\n", i, prom[i]);
// }
// } else {
// printf("Error reading PROM!\n");
// }
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
MS5611_ReadPROM(prom);
HAL_Delay(1000);
}
/* USER CODE END 3 */
}
and this is the MS5611_ReadPROM() function
HAL_StatusTypeDef MS5611_ReadPROM(uint16_t *promData) {
HAL_StatusTypeDef status;
uint8_t prom_cmd;
uint8_t rx_buf[2]={0,0};
for (uint8_t ptr = 0; ptr < 8; ptr++) {
prom_cmd = 0xA0 + (ptr * 2); // PROM read commands: 0xA0, 0xA2, ..., 0xAE
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_4, GPIO_PIN_RESET);
// Send PROM read command
status = HAL_SPI_Transmit(&hspi1, &prom_cmd, 1, HAL_MAX_DELAY);
if (status != HAL_OK) {
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_4, GPIO_PIN_SET);
return status;
}
// Receive 2 bytes PROM data (MSB, LSB)
for (uint8_t ctr = 0; ctr < 2; ctr++){
status = HAL_SPI_Receive(&hspi1, rx_buf, 2, HAL_MAX_DELAY);
}
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_4, GPIO_PIN_SET);
if (status != HAL_OK) {
return status;
}
// Combine MSB and LSB
promData[ptr] = (rx_buf[0] << 8) | rx_buf[1];
}
return HAL_OK;
}
is there any errors in this code which affects hardware
2025-06-09 9:51 PM
i have followed the stm32 stack overflow forum the 4th answer which mention to using the cubeprogrammer i have reduced the swd frequency lesser than 4000 khz. And now its also get connected in 4000 khz.
2025-06-10 4:12 AM
hey friends @mƎALLEm , @TDK as you have said i marked the solution. but i dont know how it works i followed stackoverflow questions forum to try one of the solution in the 4 answer available. by that i reduced the swd frequency to lesser than 4 Mhz and it working i have no clue how to get rid of it here after kindly help what should i don't to avoid this problem again