cancel
Showing results for 
Search instead for 
Did you mean: 

Hello, I'm using STM32F072B DISCO board, want to send CAN messages to motor controller. It stops after couple of seconds.

SPati.9
Associate II

I'm using this command for Tx, and please let me know if I'm using correct clock config as well.

uint8_t csend[] = {0x00,0x00,0x27,0x10}; // Tx Buffer

  HAL_CAN_AddTxMessage(&hcan,&txHeader,csend,&canMailbox); // Send Message

Clock config:

RCC_OscInitTypeDef RCC_OscInitStruct = {0};

 RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};

 /** Initializes the RCC Oscillators according to the specified parameters

 * in the RCC_OscInitTypeDef structure.

 */

 RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI14|RCC_OSCILLATORTYPE_HSI48;

 RCC_OscInitStruct.HSI48State = RCC_HSI48_ON;

 RCC_OscInitStruct.HSI14State = RCC_HSI14_ON;

 RCC_OscInitStruct.HSI14CalibrationValue = 16;

 RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;

 if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)

 {

  Error_Handler();

 }

 /** Initializes the CPU, AHB and APB buses clocks

 */

 RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK

               |RCC_CLOCKTYPE_PCLK1;

 RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSI48;

 RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;

 RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;

 if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK)

 {

  Error_Handler();

 }

}

 I also get this in debugger console

Debugger connection lost.

Shutting down...

2 REPLIES 2
Imen.D
ST Employee

Hello @SPati.9​ ,

I think your issue is related to STM32CubeProgrammer issue.

I advise you to check these posts: post1 and post2.

Hope this helps!

Please keep me informed about your update on this issue.

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
SPati.9
Associate II

It did not work, still

Debugger connection lost.

Shutting down...

I've tried resetting from STM32 programmer, mass_erase, software system reset in debugger and reinstalling Cube IDE as well. I'm using MAC.