This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Why is my CAN module used incorrectly

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <stdio.h>
#include <string.h>
#include "cmsis_os.h"
#include "Driver_CAN.h"
// CAN Driver Controller selector
#define CAN_CONTROLLER 1 // CAN Controller number
#define _CAN_Driver_(n) Driver_CAN##n
#define CAN_Driver_(n) _CAN_Driver_(n)
extern ARM_DRIVER_CAN CAN_Driver_(CAN_CONTROLLER);
#define ptrCAN (&CAN_Driver_(CAN_CONTROLLER))
uint32_t rx_obj_idx = 0xFFFFFFFFU;
uint8_t rx_data[8];
ARM_CAN_MSG_INFO rx_msg_info;
uint32_t tx_obj_idx = 0xFFFFFFFFU;
uint8_t tx_data[8];
ARM_CAN_MSG_INFO tx_msg_info;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

I wrote it with reference to http://www.keil.com/pack/doc/CMSIS/Driver/html/group__can__interface__gr.html 

Such waveforms have appeared before, but the program has been modified

The signal is sent in a loop, which I don't think is correct

Who CAN give me an example of using CAN module correctly to send the simplest message (code that CAN be reused)?

thank you

0