资料介绍
Table of Contents
CN0401 SPI to CAN FD Transceiver Demo
The ADuCM3029_demo_cn0401 project provides a solution to adding isolated fieldbus communication to a microcontroller circuit. The project demonstrates basic CAN FD communication, transmission and response to the ISO11898-2:2016 remote wake-up pattern, and control of switchable termination circuitry. The example code is written for the EVAL-ADICUP3029 development platform to control the EVAL-ADM3055E-ARDZ daughter board over the SPI bus interface. The daughter boards main component is the ADM3055E, an isolated signal and power CAN FD transceiver with integrated auxiliary channel.
General Description/Overview
The ADuCM3029_demo_cn0401 project uses the EVAL-ADM3055E-ARDZ to provide CAN FD bus connectivity to underlying development board that it may be added to an existing CAN FD bus as another node. This example demonstrates the EVAL-ADM3055E-ARDZ circuit features using two nodes, each a EVAL-ADM3055E-ARDZ and EVAL-ADICUP3029 development board.
The node is at first in low power mode by putting the CAN controller and transceiver to standby mode. The user can then issue a command to transmit an ASCII message on the bus. the message is repeated for 5 seconds or until it is acknowledged by another node, then the transmitting node goes to standby. If the system receives a message, particularly the slower baud rate arbitration phase, it wakes up, receives the message and displays it on the CLI terminal, then goes back to standby. A node not connected to a CAN bus can also run a self-test routine on the command of the user, in which it transmits and receives a message in loopback mode and displays a PASS of FAIL message. The initial baud rate is 500KHz for the arbitration phase and 2MHz for the data phase and the application acknowledges messages with the Standard ID (SID) of 0x300. The SID can be changed by user commands.
The application is controlled by the user with a CLI implemented using the serial UART core in the ADuCM3029 controller. The CLI is displayed on a connected PC using a serial terminal connection.
The program is divided in 2 parts: the setup part in which the present module is discovered and the main process.
To replicate the CAN FD bus described in the example both boards need to be connected to each other via the P1 or P4 connectors on the board and each in turn connected to the Arduino form factor headers of the ADICUP3029. Then each ADICUP3029 needs to be connected to the PC via USB to provide serial terminal CLI interface for each node.
Demo Requirements
The following is a list of items needed in order to replicate this demo.
- Hardware
- EVAL-ADICUP3029 (Qty 2)
- EVAL-ADM3055E-ARDZ (Qty 2)
- Micro USB to USB cable
- Dual WR-DSUB connector cable or twisted pair cable
- PC or Laptop with a USB port
- Software
- CrossCore Embedded Studio (2.8.0 or higher)
- ADuCM302x DFP (3.2.0 or higher)
- ADICUP3029 BSP (1.1.0 or higher)
- Serial Terminal Program
- Such as Putty or Tera Term
Setting up the Hardware
- Connect EVAL-ADM3055E-PMDZ board to the EVAL-ADICUP3029 as seen in the pictures below:
- Connect a micro-USB cable to P10 connector of each of the the EVAL-ADICUP3029 boards and connect them to a computer.
Configuring the Software
Most of the configuration parameters can be found in the CAN controller API module. The CAN controller API will instantiate a handler that will determine the initial configuration of the node. The handler is instantiated by the initialization structure with the following form:
struct can_ctrl_init_param { struct spi_init_param can_ctrl_spi_init; bool con_iso_crc_en; bool con_store_in_tef_en; bool con_txq_en; uint8_t tef_fifo_size; /* Number of messages in TEF FIFO*/ bool tef_time_stamp_en; enum can_ctrl_fifo_plsize txq_plsize; uint8_t txq_fifo_size; /* Number of messages in TXQ FIFO */ uint8_t txq_tx_priority; /* 0 is lowest; 0x1f is highest */ uint8_t tx_fifo_nr; enum can_ctrl_fifo_plsize tx_fifo_plsize; uint8_t tx_fifo_size; /* Number of messages in FIFO */ uint8_t tx_fifo_priority; /* 0 is lowest; 0x1f is highest */ uint8_t rx_fifo_nr; enum can_ctrl_fifo_plsize rx_fifo_plsize; uint8_t rx_fifo_size; /* Number of messages in FIFO */ bool rx_fifo_tsen; uint8_t rx_flt_nr; uint16_t rx_sid_addr; enum can_ctrl_nominal_bitrate can_nbt; enum can_ctrl_data_bitrate can_dbt; enum can_ctrl_ssp_mode ssp_mode; };
The following is a non-exhaustive list that contains the most important parameters and their values:
- can_dbt - Data bit rate; values are contained into the following enum:
enum can_ctrl_data_bitrate { BITRATE_DBT_500K, BITRATE_DBT_833K, BITRATE_DBT_1M, BITRATE_DBT_1M5, BITRATE_DBT_2M, BITRATE_DBT_3M, BITRATE_DBT_4M, BITRATE_DBT_5M, BITRATE_DBT_6M7, BITRATE_DBT_8M, BITRATE_DBT_10M };
- can_nbt - Nominal bit rate; values are contained into the following enum:
enum can_ctrl_nominal_bitrate { BITRATE_NBT_125K, BITRATE_NBT_250K, BITRATE_NBT_500K, BITRATE_NBT_1M };
- rx_fifo_nr - Number of the FIFO that will function as a RX FIFO. Between 1 and 31 when using TXQ and 0 and 31 hen not using TXQ.
- rx_fifo_plsize - Payload size for input messages. CAN FD supports up to 64 bytes.
- rx_fifo_size - Number of messages that will trigger an interrupt. Set to 1 to interrupt after every message.
- rx_fifo_tsen - Enable/Disable timestamp for messages received in this FIFO.
- rx_flt_nr - ID of the input filter active for this FIFO. can be between 0 and 7.
- rx_sid_addr - SID value of the input filter. Only messages that contain this specific SID will be received in the attached FIFO. Can be between 0 and 0x3FF.
- tx_fifo_nr - Number of the FIFO that will function as a TX FIFO. Between 1 and 31 when using TXQ and 0 and 31 hen not using TXQ.
- tx_fifo_plsize - Payload size for output messages. CAN FD supports up to 64 bytes.
- tx_fifo_size - Number of messages that need to be setup before transmission starts. Set to 1 to interrupt after every message.
These parameters can be changed in the can_ctrl_get_config function from the can_obj_layer.c file.
Outputting Data
A serial terminal is an application that runs on a PC or laptop that is used to display data and interact with a connected device (including many of the Circuits from the Lab reference designs). The device's UART peripheral is most often connected to a UART to USB interface IC, which appears as a traditional COM port on the host PC/ laptop. (Traditionally, the device's UART port would have been connected to an RS-232 line driver / receiver and connected to the PC via a 9-pin or 25-pin serial port.) There are many open-source applications, and while there are many choices, typically we use one of the following:
Before continuing, please make sure you download and install one of the above programs.
There are several parameters on all serial terminal programs that must be setup properly in order for the PC and the connected device to communicate. Below are the common settings that must match on both the PC side and the connected UART device.
- COM Port - This is the physical connection made to your PC or Laptop, typically made through a USB cable but can be any serial communications cable. You can determine the COM port assigned to your device by visiting the device manager on your computer. Another method for identifying which COM port is associated with a USB-based device is to look at which COM ports are present before plugging in your device, then plug in your device, and look for a new COM port.
- Baud Rate - This is the speed at which data is being transferred from the connected device to your PC. These parameters must be the same on both devices or data will be corrupted. The default setting for most of the reference designs in 115200.
- Data Bits - The number of data bits per transfer. Typically UART transmits ASCII codes back to the serial port so by default this is almost always set to 8-Bits.
- Stop Bits - The number of “stop” conditions per transmission. This usually set to 1, but can be set to 2 for redundancy.
- Parity - Is a way to check for errors during the UART transmission. Unless otherwise specified, set parity to “none”.
- Flow Control - Is a way to ensure that data lose between fast and slow devices on the same UART bus are not lost during transmission. This is typically not implemented in a simple system, and unless otherwise specified, set to “none”.
In many instances there are other options that each of the different serial terminal applications provide, such as local line echo or local line editing, and features like this can be turned on or off depending on your preferences. This setup guide will not go over all the options of each tool, but just the minor features that will make it easier to read back data from the connected devices.
Example setup using Putty
- Plug in your connected device using a USB cable or other serial cable.
- Wait for the device driver of the connected device to install on your PC or Laptop.
- Open up your serial terminal program (Putty for this example)
- Click on the open button, and as long as your connected device and serial terminal program are setup the same, than you should see data displaying.
Available commands
Typing help or h after initial calibration sequence will display the list of commands and their short versions. Bellow is the short command list:
Command | Example | Description |
---|---|---|
General commands | ||
h | h | Display available commands. |
Communication commands | ||
ct <msg> | ct Hello world! | Send a message through the CAN bus. <msg> = Message to be sent. |
css <sid> | css 245 | Set standard ID for the CAN messages sent. <sid> = Standard ID in hexadecimal; between 0x000 and 0x3FF. |
cg | ct | Get received messages if any. |
test | test | Perform a loopback test. |
- For the “h”, “cg” and “test” commands press Enter without inserting any space afterwards.
- For the “ct” and “css” commands, to invoke in application instructions, write just the command without parameters, insert a space afterwards and press Enter.
Obtaining the Source Code
We recommend not opening the project directly, but rather import it into CrossCore Embedded Studios and make a local copy in your workspace.
The source code and include files of the ADuCM3029_demo_cn0401 can be found here:
How to use the Tools
The official tool we promote for use with the EVAL-ADICUP3029 is CrossCore Embedded Studio. For more information on downloading the tools and a quick start guide on how to use the tool basics, please check out the Tools Overview page.
Importing
For more detailed instructions on importing this application/demo example into the CrossCore Embedded Studios tools, please view our How to import existing projects into your workspace section.
Debugging
For more detailed instructions on importing this application/demo example into the CrossCore Embedded Studios tools, please view our How to configure the debug session section.
Project Structure
Project structure includes:
- CAN controller API module: can_obj_layer.c, can_obj_layer.h;
- Main file ADuCM3029_demo_cn0401.c
- Application module with files: cn0401.c, cn0401.h;
- CLI module with files: cli.c, cli.h;
- SPI platform driver module: spi.c, spi.h;
- System delays module: delay.c, delay.h;
- GPIO platform driver module: gpio.c, gpio.h;
- External interrupts module: interrupt.c, interrupt.h;
- UART platform driver module: uart.c, uart.h;
- Platform drivers header: platform_drivers.h;
- Error header: error.h;
- Power core initialization module with files: power.c, power.h;
- Timer and delay driver module with files: timer.c, timer.h.
End of Document
- KPS305D开关电源电路图下载 144次下载
- KPS305DF电路图下载 59次下载
- KPS305DF开关电源电路图下载 20次下载
- 爱华无线电接收机FR-A305维修手册 0次下载
- EVAL-CN0391-ARDZ屏蔽 10次下载
- EVAL-CN0395-ARDZ屏蔽 10次下载
- EVAL-CN0397-ARDZ屏蔽 8次下载
- ADALM-BUCK-ARDZ用户指南 12次下载
- EVADM305E-ARDZ硬件 4次下载
- EVAL-ADL5902-ARDZ-评估软件 6次下载
- EVAL-AD8302-ARDZ-评估软件 6次下载
- EVAL-ADT7420ARDZ - Schematic 8次下载
- EVAL-AD8302-ARDZ - Evaluation Software 0次下载
- 微型压式传感器LF305参数说明 15次下载
- 305摄像头万能驱动下载 148次下载
- PCAN软件的使用操作说明 488次阅读
- SIMATIC S7-300系统结构介绍 439次阅读
- 软件过程定义是什么 软件过程的要素包括哪些 674次阅读
- SWE.2软件架构设计 448次阅读
- 欧姆龙编程软件CX-One和仿真软件安装教程 1.8w次阅读
- 软件库存管理中的常见挑战 279次阅读
- 如何使用openEuler用户软件仓(EUR) 793次阅读
- 大文件Vlookup工具:日常优化工作必备神器 2052次阅读
- 常见的组态软件有哪些 1.1w次阅读
- 软件测试书籍有哪些_软件测试书籍推荐 1.4w次阅读
- 软件测试是干什么的?软件测试的5个基本流程介绍 5w次阅读
- 组态软件有哪些_组态软件哪个好_组态软件推荐(三款) 38.9w次阅读
- 组态软件是什么_组态软件有什么用 3.5w次阅读
- 什么是软件测试环境_软件测试环境有哪几种_做软件测试要用到什么工具 4.7w次阅读
- 电路设计软件有哪些_电路图设计软件哪种最好_手机绘制电路图软件 19w次阅读
下载排行
本周
- 1电子电路原理第七版PDF电子教材免费下载
- 0.00 MB | 1491次下载 | 免费
- 2单片机典型实例介绍
- 18.19 MB | 95次下载 | 1 积分
- 3S7-200PLC编程实例详细资料
- 1.17 MB | 27次下载 | 1 积分
- 4笔记本电脑主板的元件识别和讲解说明
- 4.28 MB | 18次下载 | 4 积分
- 5开关电源原理及各功能电路详解
- 0.38 MB | 11次下载 | 免费
- 6100W短波放大电路图
- 0.05 MB | 4次下载 | 3 积分
- 7基于单片机和 SG3525的程控开关电源设计
- 0.23 MB | 4次下载 | 免费
- 8基于AT89C2051/4051单片机编程器的实验
- 0.11 MB | 4次下载 | 免费
本月
- 1OrCAD10.5下载OrCAD10.5中文版软件
- 0.00 MB | 234313次下载 | 免费
- 2PADS 9.0 2009最新版 -下载
- 0.00 MB | 66304次下载 | 免费
- 3protel99下载protel99软件下载(中文版)
- 0.00 MB | 51209次下载 | 免费
- 4LabView 8.0 专业版下载 (3CD完整版)
- 0.00 MB | 51043次下载 | 免费
- 5555集成电路应用800例(新编版)
- 0.00 MB | 33562次下载 | 免费
- 6接口电路图大全
- 未知 | 30320次下载 | 免费
- 7Multisim 10下载Multisim 10 中文版
- 0.00 MB | 28588次下载 | 免费
- 8开关电源设计实例指南
- 未知 | 21539次下载 | 免费
总榜
- 1matlab软件下载入口
- 未知 | 935053次下载 | 免费
- 2protel99se软件下载(可英文版转中文版)
- 78.1 MB | 537793次下载 | 免费
- 3MATLAB 7.1 下载 (含软件介绍)
- 未知 | 420026次下载 | 免费
- 4OrCAD10.5下载OrCAD10.5中文版软件
- 0.00 MB | 234313次下载 | 免费
- 5Altium DXP2002下载入口
- 未知 | 233046次下载 | 免费
- 6电路仿真软件multisim 10.0免费下载
- 340992 | 191183次下载 | 免费
- 7十天学会AVR单片机与C语言视频教程 下载
- 158M | 183277次下载 | 免费
- 8proe5.0野火版下载(中文版免费下载)
- 未知 | 138039次下载 | 免费
评论
查看更多