FDCAN2(STM32), MCP2518FD

dank27·2022년 5월 8일
0

작성일: 2022-05-08

DS12110, STM32H742xI/G STM32H743xI/G, https://www.st.com/resource/en/datasheet/stm32h743vi.pdf

RM0433, Reference manual(STM32H743), https://www.st.com/resource/en/reference_manual/dm00314099-stm32h742-stm32h743-753-and-stm32h750-value-line-advanced-arm-based-32-bit-mcus-stmicroelectronics.pdf

MCP25XXFD Family Reference Manual, http://ww1.microchip.com/downloads/en/DeviceDoc/MCP251XXFD-CAN-FD-Controller-Module-Family-Reference-Manual-20005678B.pdf

AN5438, FDCAN peripheral on STM32 devices, https://www.st.com/resource/en/application_note/an5348-fdcan-peripheral-on-stm32-devices-stmicroelectronics.pdf

STM32H743 에서 USB High-speed일 경우 FDCAN2 사용하지 못함

USB ULPI, FDCAN2 pin list

USB ULPI(High-Speed)FDCAN2
• OTG_HS_ULPI_STP• FDCAN2_TX
• OTG_HS_ULPI_DIR• FDCAN2_RX
• OTG_HS_ULPI_NXT
• OTG_HS_ULPI_CK
• OTG_HS_ULPI_D0
• OTG_HS_ULPI_D1
• OTG_HS_ULPI_D2
• OTG_HS_ULPI_D3
• OTG_HS_ULPI_D4
• OTG_HS_ULPI_D5
• OTG_HS_ULPI_D6
• OTG_HS_ULPI_D7

FDCAN2_RX alternate function ULPI와 충돌

STM32H743에서 FDCAN2_RX는 alternate function 으로 두 군데에서 선택할 수 있으나 아래와 같이 OTG_HS_ULPI_D* 과 겹치는 문제 발생

  • ULPI는 한곳에서만 사용 가능
Pin nameAlternate functions
PB5TIM17_BKIN,TIM3_CH2, HRTIM_EEV7, ITIM17_BKIN,TIM3_CH2, HRTIM_EEV7, I2C1_SMBA, SPI1_MOSI/I2S1_SDO, I2C4_SMBA, SPI3_MOSI/I2S3_SDO, SPI6_MOSI, FDCAN2_RX, OTG_HS_ULPI_D7, ETH_PPS_OUT, FMC_SDCKE1, DCMI_D10, UART5_RX,EVENTOUT
PB12TIM1_BKIN, I2C2_SMBA, SPI2_NSS/I2S2_WS, DFSDM1_DATIN1, USART3_CK, FDCAN2_RX, OTG_HS_ULPI_D5, ETH_MII_TXD0/ETH_RMII_TXD0, OTG_HS_ID, TIM1_BKIN_COMP12, UART5_RX, EVENTOUT


FDCAN vs MCP2518FD

MICROCHIP의 MCP2518FD로 FDCAN를 대체 가능한지 검토.

위 두 컨트롤러 모두 CAN2.0B, CAN FD (ISO 11898-1:2015)를 지원하고 있음.

RX element

FDCAN

RM0433, Table 487. Rx buffer and FIFO element

RM0433, Table 488. Rx buffer and FIFO element description, R0 bits 28:0 ID[28:0]

  • ESI: Error state indicator
    • 0: Transmitting node is error active
    • 1: Transmitting node is error passive
  • XTD: Extended identifier
    • 0: 11-bit standard identifier
    • 1: 29-bit extended identifier
  • RTR: Remote transmission requeset
    • 0: Received frame is a data frame
    • 1: Received frame is a remote frame
  • ID[28:0] Identifier
    • A standard identifier is stored into ID[28:18]
  • ANMF: Accepted non-matching frame
    • 0: Received frame matching filter index FIDX
    • 1: Received frame did not match any Rx filter element
  • FIDX[6:0]: Filter index
  • FDF: FD format
    • 0: Standrad frame format
    • 1: FDCAN frame format ( new DLC-coding and CRC)
  • BRS: Bitrate Switch
    • 0: Frame received without bitrate switching
    • 1: Frame received with bitrate switching
  • DLC[3:0]: Data length code
  • RXTS[15:0]: Rx timestamp
  • DB: Data Byte

MCP2518FD

MCP25XXFD, TABLE 7-1: RECEIVE MESSAGE OBJECT

  • SD11: In FD mode, the Standard ID can be extended to 12 bits using r1
  • EID[17:0]: Extended Identifier bits
  • SID[10:0] Standard Identifier bits
  • FILTHIT[4:0]: Filter Hit, number of filter that matched
  • ESI: Error Status indicator bit
  • FDF: FD Frame, distinguishes between CAN and CAN FD formats
    • 1 - CAN FD frame
  • BRS: Bit Rate Switch; indicates if data bit rate was switched
  • RTR: Remote Transmission Request; not used in CAN FD
  • IDE: Identifier Extendsion Flag
    • 1 - extended frame
  • DLC[3:0]: Data Length Code bits
  • RXMSGTS[31:0]: Receive Message Timestamp bits

FILTER

FDCANMCP2518FD
128 filter elements(11-bit IDs) / 64 filter elements(29-bit IDs)32 acceptance filters
range filter / filter for one or two dedicated IDs / classic bit mask filtera Filter Object and a Mask Object
Each filter element is configurable for acceptance or rejection filtering

BIT TIME(baud rate)

FDCAN

RM0433 Figure 740. Bit timing

MCP2518FD

MCP25XXFD, Figure 3-2: Partition of Bit Time

MCP25XXFD, Equation 3-1: Nominal Bit Rate/Time

MCP25XXFD, Equation 3-3: Norminal Time Quanta

MCP25XXFD, Euqation 3-5: Number of NTQ in a NBT

⇒ MCP2518FD에서는 위 값들 + NSJW 로 Oscillator tolerance condition 들을 계산하고 있어서 확인이 더 필요함

Low-Speed vs High-Speed CAN

Physical organization(transceiver)

High-Speed CANLow-Speed CAN (Fault-Tolerant CAN )
ISOISO 11898-2ISO 11898-3
baud rate~ 1 Mbit/s (default: 500 kbit/s)~ 125 Kbit/s
resistancecable with a nominal impdedance of 120 ohmeach device has its own termination

High-speed CAN signaling. ISO 11898-2
https://en.wikipedia.org/wiki/CAN_bus#/media/File:ISO11898-2.svg

Low-speed CAN signaling .ISO 11898-3
https://en.wikipedia.org/wiki/CAN_bus#/media/File:ISO11898-3_Waveform.svg

기타

CAN-FD vs CAN 2.0

AN5348, Figure 2. Frame architecture of CAN-FD versus CAN2.0

  • CAN 2.0 만 - RTR bit
  • CAN-FD 만 - EDL(Extend data length) bit, BRS(Bit rate switching) bit, ESL(Error state indicator) bit
  • DLC(data length code)- 4-bit

AN5348, Table 2. Payload data length codes(bytes)

AN5348, Table 3.Main differences between CAN-FD an CAN 2.0


MCP2518FD operation mode

The CAN FD Controller module has eight modes of operation(CiCON.REQOP)

  • Configuration mode
  • Normal CAN FD mode
  • Normal CAN 2.0 mode
  • Sleep mode
  • Listen Only mode
  • Restricted Operation mode
  • Internal Loopback mode
  • External Loopack mode

Configuration Mode
The following registers and bit fileds can only be programmed during Configuration mode:

  • CiCON: TXQEN, STEF, SERR2LOM, ESIGM, RTXAT, WAKFIL, PXEDIS, ISOCRCEN
  • CiNBTCFG, CiDBTCFG, CiTDC
  • CiTXQCON: PLSIZE, FSIZE
  • CiFIFOCONm: PLSIZE, FSIZE, TXEN, RXTSEN
  • CiTEFCON: FSIZE, TEFTSEN

The oscillator, FIFOs and bit time can only be configured in Configuration mode.
⇒ bit time 변경은 configuration mode 에서

Normal Modes

  • NORMAL CAN FD MODE (REQOP = 000)
  • NORMAL CAN 2.0 MODE (REQOP = 110)
    • The FDF, BRS and ESI bits in the TX Objects will be ignored and transmitted as ‘0’

⇒ CAN 2.0, CAN FD를 고정하는 mode 가 존재함

profile
임베디드 시스템 개발자의 공부 노트

0개의 댓글