Renesas RH850 Series Application Note
Hide thumbs Also See for RH850 Series:

Advertisement

Quick Links

RH850 Series
CAN Transmit Procedure (CAN FD Mode)
Summary
This document describes an example of a procedure for transmitting CAN using the RH850 series. Please refer to the
notes in the latest user's manual hardware edition for the settings of each register.
Operation Confirmed Devices
This document applies to the RH850 series.
The variables described in the text are as follows.
RS-CAN FD channel number
GAFLIDj, GAFLMj, GAFLP0j,
GAFLP1j Register numbers
Transmit/Receive FIFO buffer
number
Receive FIFO buffer number
Receive buffer number
Transmit buffer number
RAM test number
GAFLCFGi、GTINTSTSi
register number
Number of each status register
The functions marked with "★" in the text are applicable to cases where 2 or more channels are installed.
In the text, CFD is omitted from the register names.
R01AN6029EJ0100 Rev.1.0
May 10, 2017
Table 1-1 Target Devices and Variables
Variable
RH850/E2x RH850/E1M-S2 RH850/P1M-E
m
j
k
x
q
p
r
i
y
Target MCU
0~4
0~3
0~15
0~15
0~14
0~11
0~7
0~7
0~79
0~63
0~79
0~63
0~63
0~63
0
0
0~2
0,1
Application Note
R01AN6029EJ0100
Rev.1.0
0~2
0~15
0~8
0~7
0~47
0~47
0~63
0
0,1
Page 1 of 42

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the RH850 Series and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Summary of Contents for Renesas RH850 Series

  • Page 1 CAN Transmit Procedure (CAN FD Mode) Summary This document describes an example of a procedure for transmitting CAN using the RH850 series. Please refer to the notes in the latest user's manual hardware edition for the settings of each register.
  • Page 2: Table Of Contents

    RH850 Series CAN Transmit Procedure (CAN FD Mode) Contents Transmit Function ......................3 Transmission Using Transmit Buffers ................4 Transmission Using Transmit/Receive FIFO Buffers ............18 Transmission Using Transmit Queue ................26 Transmit History Buffer Function ..................30 CAN-related Interrupt Processing ................... 36 Transmit Data Padding (only in CAN FD mode) .............
  • Page 3: Transmit Function

    RH850 Series CAN Transmit Procedure (CAN FD Mode) Transmit Function The functions that can be used when transmitting CAN messages are shown below. For details on each process, refer to the following chapters. • ・Transmit using the transmit buffer • ・Transmit using the transmit / receive FIFO buffer •...
  • Page 4: Transmission Using Transmit Buffers

    RH850 Series CAN Transmit Procedure (CAN FD Mode) Transmission Using Transmit Buffers The transmit buffer is used to send data frames or remote frames. There are 16 transmit buffers per channel, which can be used as a transmit buffer, for linking to the transmit/receive ★...
  • Page 5 RH850 Series CAN Transmit Procedure (CAN FD Mode) Message Transmit Function This is the function to send data frames or remote frames. A message can be sent by setting a transmit request in the transmit buffer (the TMTR bit of the TMCp register is “1”).
  • Page 6 RH850 Series CAN Transmit Procedure (CAN FD Mode) 2.1.1 Procedure for Sending Messages from Transmit Buffer Figure 2-2 shows the procedure for sending messages from the transmit buffer. START Write "B'00" to the transmission buffer transmit result flag* Is the transmit buffer status register "H'00"?
  • Page 7 RH850 Series CAN Transmit Procedure (CAN FD Mode) arbitration lost (the message will be aborted in case of one-shot transmissions, and the message will be retained (retransmitted) in case of normal transmissions). A message will not be successfully sent unless it is sent without an arbitration lost or while the CAN bus is idle.
  • Page 8 RH850 Series CAN Transmit Procedure (CAN FD Mode) When a transmit request is issued (the TMTRM bit of the TMSTSp register is “1”) and a transmit abort request is issued to the transmit buffer (the TMTAR bit of the TMCp register is “1”), the transmit request is cancelled.
  • Page 9 RH850 Series CAN Transmit Procedure (CAN FD Mode) 2.2.1 Transmit Abort Procedure Figure 2-5 shows the procedure for transmit abort. START Set the transmit abort request of the target transmit 、 、 、 buffer* 【Note】 1. Rewrite the TMCp register in channel communication mode or channel standby mode.
  • Page 10 RH850 Series CAN Transmit Procedure (CAN FD Mode) One-Shot Transmission Function When the TMOM bit of the RSCFDn(CFD)TMCp register is set to 1 (one-shot transmission is enabled), transmission is performed only once. Even if an arbitration lost or an error occurs, retransmission is not performed.
  • Page 11 RH850 Series CAN Transmit Procedure (CAN FD Mode) 2.3.1 One-shot Transmission Procedure Figure 2-7 shows the one-shot transmission procedure. START Write "B'00" to the transmit buffer transmission result flag The transmit buffer status register is "H'00"? 、 Store messages in the transmit buffer ・...
  • Page 12 RH850 Series CAN Transmit Procedure (CAN FD Mode) 12. Depending on the timing, the transmission result will be transmission is completed: There is a transmit abort (the TMTRF[1:0] flag in the TMSTSp register is "B'11"), so if the transmission result is to be determined, please check not only if the transmission is complete (TMTRF [1:0] flag is "B'01") but also if the...
  • Page 13 RH850 Series CAN Transmit Procedure (CAN FD Mode) Transmit Buffer Interrupt Processing 2.4.1 Transmit Complete Interrupt Processing If the transmit complete interrupt is enabled, the CANm transmit interrupt is generated when the transmission is completed. Whether to enable or disable the transmit complete interrupt can be set for each transmit buffer by the TMIEp bit of the TMIECy register.
  • Page 14 RH850 Series CAN Transmit Procedure (CAN FD Mode) 2.4.3 Processing Procedure after Transmission Completion and Transmit Abort Completion Figure 2-8, Figure 2-9, and Figure 2-10 show the processing procedure after the transmission is completed and the transmit abort is completed.
  • Page 15 RH850 Series CAN Transmit Procedure (CAN FD Mode) START Search buffers after transmission is completed Write "B'00" to the transmit buffer transmission result 、 flag User processing after transmission is completed 【Note】 1. For the TMTRF [1: 0] flag in the TMSTSp register, write "B'00" in channel communication mode or channel standby mode.
  • Page 16 RH850 Series CAN Transmit Procedure (CAN FD Mode) Transmit Buffer Merge Mode (Only in CAN FD Mode) Transmit buffers can transmit messages with a payload length of 20 bytes, but can transmit messages with a payload length of up to 64 bytes by merging three transmit buffers in transmit buffer merge mode.
  • Page 17 RH850 Series CAN Transmit Procedure (CAN FD Mode) Figure 2-11 shows the procedure for sending a message from the transmit buffer using the transmit buffer merge mode. START Write "B'1" to the transmit buffer merge mode enable bit Write "B'00" to the transmit buffer transmit result...
  • Page 18: Transmission Using Transmit/Receive Fifo Buffers

    RH850 Series CAN Transmit Procedure (CAN FD Mode) Transmission Using Transmit/Receive FIFO Buffers Data frames or remote frames are transmitted with the transmit/receive FIFO buffer. There are 3 transmit / receive FIFO buffers per channel and can store up to 128 messages. It will be sent in order from the first stored message.
  • Page 19 RH850 Series CAN Transmit Procedure (CAN FD Mode) Message Transmit Function This is the function to transmit data frames or remote frames. The messages stored in the transmit/receive FIFO buffer are transmitted in the order in which they were stored.
  • Page 20 RH850 Series CAN Transmit Procedure (CAN FD Mode) 3.1.1 Message Transmission Procedure from Transmit/receive FIFO Figure 3-2 shows the procedure for sending a message from the transmit/receive FIFO buffer, and Figure 3-3 and Figure 3-4 show the procedure for enabling/prohibiting the transmit/receive FIFO buffer.
  • Page 21 RH850 Series CAN Transmit Procedure (CAN FD Mode) START Transmit/receive FIFO buffer is empty? 、 、 Enable use of transmit/receive FIFO buffer* 【Note】 1. When using the transmit mode, if the transmit/receive FIFO buffer is disabled, the transmit/receive FIFO buffer will be empty after transmission completion, CAN bus error detection, or arbitration lost if the message is being transmitted or is determined to be the next transmission.
  • Page 22 RH850 Series CAN Transmit Procedure (CAN FD Mode) Transmit Abort Function By disabling the use of the transmit/receive FIFO buffer, the messages in the transmit/receive FIFO buffer can be aborted. Aborting the transmit/receive FIFO buffer aborts all messages in the transmit/receive FIFO buffer, not just the messages being sent (the transmit/receive FIFO buffer becomes empty (the CFEMP flag in the CFSTSk register is “1”)).
  • Page 23 RH850 Series CAN Transmit Procedure (CAN FD Mode) Interval Transmission Function To transmit messages continuously from the same transmit/receive FIFO buffer that is set to transmit mode or ★ gateway mode , message transmission interval time can be set. When the use of the transmit/receive FIFO buffer is enabled (the CFE bit of the CFCCk register is “1”), the interval timer starts counting after the first message is successfully transmitted from the transmit/receive FIFO buffer ((After the 7th bit of EOF in the CAN protocol).
  • Page 24 RH850 Series CAN Transmit Procedure (CAN FD Mode) Transmit at the interval timer Count starts when transmission underflow timing is completed Counting does not stop even if the transmit/receive FIFO is empty CAN Bus Msg1 Msg2 Msg3 Msg4 Interval timer...
  • Page 25 RH850 Series CAN Transmit Procedure (CAN FD Mode) Interrupt Processing of Transmit/receive FIFO Buffer (Transmit Mode) 3.4.1 Transmit/receive FIFO Transmit Interrupt Processing If the transmit/receive FIFO transmission completion interrupt is enabled, the CANm transmit interrupt is generated when the condition selected in the CFIM bit setting of the CFCCk register is satisfied.
  • Page 26: Transmission Using Transmit Queue

    RH850 Series CAN Transmit Procedure (CAN FD Mode) Transmission Using Transmit Queue The transmit queue is used to transmit data frames or remote frames. The transmit queue is allocated up to 16 buffers per channel, and the transmit buffer [16 x m + 15] is the common access window.
  • Page 27 RH850 Series CAN Transmit Procedure (CAN FD Mode) 4.1.1 Message Transmission Procedure from Transmit Queue Figure 4-2 shows the procedure for transmitting messages from the transmit queue, and Figure 4-3 and Figure 4-4 show the procedure for enabling or prohibiting the transmit queue.
  • Page 28 RH850 Series CAN Transmit Procedure (CAN FD Mode) START Is the transmit queue empty? 、 、 Enable use of the transmit queue 【Note】 1. Disabling the transmit queue immediately empties the message in the transmit queue if it is not being transmitted and is not determined for the next transmission.
  • Page 29 RH850 Series CAN Transmit Procedure (CAN FD Mode) Transmit Abort Function By prohibiting the use of the transmit queue, messages in the transmit queue can be aborted. Transmit queue abort will abort all messages in the transmit queue, not just the message being transmitted (the transmit queue will be empty (the TXQEMP flag in the TXQSTSm register will be "1")).
  • Page 30: Transmit History Buffer Function

    RH850 Series CAN Transmit Procedure (CAN FD Mode) Transmit History Buffer Function Information on messages that have been transmitted (transmit history data) can be stored in the transmit history buffer. Each channel has one transmit history buffer, and the transmit history buffer can store 16 transmit history data.
  • Page 31 RH850 Series CAN Transmit Procedure (CAN FD Mode) バッファタイプ B’01 B’10 送信バッファ 送受信FIFOバッファ バッファ番号 B’00 送信バッファi×4+0 CFCCHkレジスタの B’01 送信バッファi×4+1 CFTML[1:0]ビットで送受信 B’10 送信バッファi×4+2 FIFOバッファにリンクさせ た送信バッファの番号 B’11 送信バッファi×4+3 R01AN6029EJ0100 Rev.1.0 Page 31 of 42 May 10, 2017...
  • Page 32 RH850 Series CAN Transmit Procedure (CAN FD Mode) Figure 5-1 shows the operation of the transmit history buffer. Transmit history buffer 0 Transmit buffer 0/LBL1 Transmit history buffer 1 Transmit buffer 1/LBL2 Transmit history buffer 5 Transmit buffer 3/LBL6 Transmit history buffer 7...
  • Page 33 RH850 Series CAN Transmit Procedure (CAN FD Mode) 5.1.1 Transmit History Buffer Read Procedure Figure 5-2 shows the procedure for reading transmit history data from the transmit history buffer, and Figure 5-3 and Figure 5-4 show the procedure for enabling and prohibiting the use of the transmit history buffer.
  • Page 34 RH850 Series CAN Transmit Procedure (CAN FD Mode) START Is the transmit history buffer empty? Enable use of the transmit history buffer* 【Note】 1. Rewrite the enable/disable of the transmit history buffer (the THLE bit of the THLCCm register) in channel communication mode or channel standby mode.
  • Page 35 RH850 Series CAN Transmit Procedure (CAN FD Mode) Transmit History Buffer Interrupt Processing 5.2.1 Transmit History Buffer Interrupt Processing If the transmit history interrupt is enabled, the CANm transmit interrupt is generated when the condition selected in the THLIM bit setting of the THLCCm register is satisfied.
  • Page 36: Can-Related Interrupt Processing

    RH850 Series CAN Transmit Procedure (CAN FD Mode) CAN-related Interrupt Processing When using interrupts, the interrupt source flag must be cleared to “0”. For the CAN-related flags related to each interrupt source flag on the interrupt control side, see "8.2 CAN-related interrupt sources".
  • Page 37: Transmit Data Padding (Only In Can Fd Mode)

    RH850 Series CAN Transmit Procedure (CAN FD Mode) Transmit Data Padding (only in CAN FD mode) If the payload length indicated by the DLC value of the set transmit message exceeds the payload storage area size of the buffer used for transmission, the excess payload is padded with “CCH”.
  • Page 38: Precautions For Processing Flow

    RH850 Series CAN Transmit Procedure (CAN FD Mode) Precautions for Processing Flow About Functions In this application note, there is a part that is functionalized even in the processing of single line, but this is only described as a function to clarify the processing for each function. When you actually create a program, you don't necessarily have to make it functional.
  • Page 39: Appendix

    RH850 Series CAN Transmit Procedure (CAN FD Mode) Appendix Request to Transmit Buffer The interrupt source that activates depends on the request to be issued to the transmit buffer and the conditions under which transmission is stopped. Table 8-1 lists the requests to the transmit buffer and the interrupt sources.
  • Page 40 RH850 Series CAN Transmit Procedure (CAN FD Mode) Interrupt Occurrence Source Configuration Interrupt Source Request Clear (Enable) Unit * Method * Global receive Receive FIFOx RFIE bit of the When the condition set by the RFIF flag FIFO interrupt interrupt request...
  • Page 41 RH850 Series CAN Transmit Procedure (CAN FD Mode) Table 9-2 CAN-related Interrupt Sources 【Note】 The interrupt request flag and interrupt enable bit in the interrupt function are not described. For details, refer to the interrupt chapter in the hardware chapter of each user's manual.
  • Page 42 RH850 Series CAN Transmit Procedure (CAN FD Mode) Our Company’s Website and Inquiry Website http://japan.renesas.com/ Inquiry http://japan.renesas.com/contact/ All trademarks and registered trademarks are the property of their respective owners. R01AN6029EJ0100 Rev.1.0 Page 42 of 42 May 10, 2017...
  • Page 43 Revision History Description Rev. Date Page Summary — 2017.5.10 Initial edition...
  • Page 44 Precautions for use of the product This section describes the "Precautions" that apply to all microcontroller products. Please refer to this document and the Technical Update for precautions on individual products. Treatment of unused pins [Caution] Please dispose of unused pins according to "Handling of unused pins" in the text. The impedance of the input pins of CMOS products is generally high impedance.

Table of Contents