This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS570LS3137: 使用CAN发送并接收数据,发送时外部CAN工具无法接收到数据

Part Number: TMS570LS3137
Other Parts Discussed in Thread: HALCOGEN

项目代码使用HALCOGEN生成,参考example_canCommunication.c文件,版本04.07.01,CCS版本Version: 8.3.1.00004,配置如下:

调用代码如下:

外部CAN工具无法接收到数据,且第二次调用canTransmit函数,直接失败返回

 canInit代码如下:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
void canInit(void)
{
/* USER CODE BEGIN (4) */
/* USER CODE END */
/** @b Initialize @b CAN1: */
/** - Setup control register
* - Disable automatic wakeup on bus activity
* - Local power down mode disabled
* - Disable DMA request lines
* - Enable global Interrupt Line 0 and 1
* - Disable debug mode
* - Release from software reset
* - Enable/Disable parity or ECC
* - Enable/Disable auto bus on timer
* - Setup message completion before entering debug state
* - Setup normal operation mode
* - Request write access to the configuration registers
* - Setup automatic retransmission of messages
* - Disable error interrupts
* - Disable status interrupts
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • 你好,我查看下相关资料后回复您。

  • 你好,你注意到了这几个步骤吗?

  • 是的,已经注意到,例程是使用CAN1发CAN2收,我的工程只是CAN1发送给外部CAN工具,然后在接收外部CAN工具发送的数据,下图是我的HALCOGEN配置

  • 图中是其他配置

    这是调用代码

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    int main(void)
    {
    /* USER CODE BEGIN (3) */
    //dccInit();
    canInit();
    canTransmit(canREG1, canMESSAGE_BOX1, tx_data); //CAN
    //canTransmit(canREG1, canMESSAGE_BOX1, tx_data);
    // canTransmit(canREG1, canMESSAGE_BOX1, tx_data);
    //canTransmit(canREG1, canMESSAGE_BOX1, tx_data);
    while(1){
    while(!canIsRxMessageArrived(canREG1, canMESSAGE_BOX2));
    canGetData(canREG1, canMESSAGE_BOX2, rx_data); /* receive on can1 */
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • 我将咨询相关工程师,一旦有回复会立即回复您。

  • 感谢您对TI产品的关注!为更加有效地解决您的问题,我们建议您将问题发布在E2E英文技术论坛上e2e.ti.com/.../arm-based-microcontrollers-forum,将由资深的英文论坛工程师为您提供帮助。

x 出现错误。请重试或与管理员联系。