This example contains a simple STM32CubeMX + Atollic project based on the STM32F7-Disco board which is able to transmit a CANbus Frame. On top of that the board has a really basic GUI with touchscreen capabilities to activate/deactivate the transmission and of course give a feedback of the procedure. You can freely use alter copy this project but keep in mind that it is a sample and not commented at all.

If you want to configure the CANBus frame details and/or the transmission time, please goto /Src/main.c line 65-66 and change the following variables according to your needs

/* USER CODE BEGIN PV */
/* Private variables ---------------------------------------------------------*/</code>

static uint32_t cycle_time = 100;
static CanTxMsgTypeDef can_frame = 
                                { .StdId = 0x123, 
                                  .DLC = 8 , 
                                  .Data = { 0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08}
                                };
static char text_buffer[100];
static char messages[9][100];
uint8_t transition = 0x00;
uint8_t state = 0x00;
uint32_t last_transmission = 0;

/* USER CODE END PV */

 

Github : https://github.com/devcoons/stm32-canframe-transmitter

 

Author

Write A Comment