GRLIB CAN_OC Model

The CAN_OC device is part of the OpenCores and the GRLIB IP libraries. It is available in libTEMUOpenCores.so.

Loading the Plugin

import OpenCores

Configuration

There are two configuration parameters in the CAN device. Firstly the config.interrupt property can be set to influence the interrupt that is raised with the IRQ controller. Setting that property also updates the AHB PnP info.

The second configuration property is config.infiniteSpeed. If that property is set, messages will be sent immediately instead of being scheduled.

The device should be connected to an interrupt controller and a CAN bus, to work properly.

@CAN_OC Reference

Properties

Name Type Description

Class

*void

Class object

Component

*void

Pointer to component object if part of component

LoggingFlags

uint64_t

Flags for logging info

Name

*char

Object name

TimeSource

*void

Time source object

Commands

Name Description

delete

Dispose instance of @CAN_OC

new

Create new instance of CAN_OC

Command new Arguments

Name Type Required Description

name

string

yes

Name of object to create

CAN_OC Reference

Properties

Name Type Description

Class

*void

Class object

Component

*void

Pointer to component object if part of component

LoggingFlags

uint64_t

Flags for logging info

Name

*char

Object name

TimeSource

*void

Time source object

basiccan.acceptCode

uint8_t

Accept Code register for BasicCAN mode.

basiccan.acceptMask

uint8_t

Accept Mask register for BasicCAN mode.

basiccan.ctrl

uint8_t

Control register for BasicCAN mode.

basiccan.txID

[uint8_t; 2]

TxID registers for BasicCAN mode.

bus

temu_IfaceRef/ <unknown>

CAN bus the device is connected to.

busTiming

[uint8_t; 2]

Bus Timing registers.

clockDivider

uint8_t

Clock Divider register.

command

uint8_t

Command register.

config.infiniteSpeed

uint8_t

Enable infinite speed mode (no delays when sending messages).

config.interrupt

uint8_t

External interrupt raised with IRQ controller.

fifo.data

[uint8_t; 64]

RX FIFO data buffer.

fifo.start

uint32_t

RX FIFO buffer start location.

fifo.usage

uint32_t

RX FIFO buffer usage.

interrupt

uint8_t

Interrupt register.

irqCtrl

temu_IfaceRef/ <unknown>

Interrupt controller.

pelican.acceptCode

[uint8_t; 4]

Accept Code registers for PeliCAN mode.

pelican.acceptMask

[uint8_t; 4]

Accept Mask registers for PeliCAN mode.

pelican.arbLostCaputure

uint8_t

Arbitration Lost Capture register for PeliCAN mode.

pelican.errCodeCapture

uint8_t

Error Code Capture register for PeliCAN mode.

pelican.errWarnLimit

uint8_t

Error Warning Limit register for PeliCAN mode.

pelican.interruptEnable

uint8_t

Interrupt Enable register for PeliCAN mode.

pelican.mode

uint8_t

Mode register for PeliCAN mode.

pelican.rxErrCounter

uint8_t

RX Error Counter register for PeliCAN mode.

pelican.rxMsgCounter

uint8_t

RX Message Counter register for PeliCAN mode.

pelican.txErrCounter

uint8_t

TX Error Counter register for PeliCAN mode.

pelican.txFI

uint8_t

TX Frame Info register for PeliCAN mode.

pelican.txID

[uint8_t; 4]

TxID registers for PeliCAN mode.

status

uint8_t

Status register.

txData

[uint8_t; 8]

TX data buffer (excluding TX FI and TX ID registers).

Interfaces

Name Type Description

AhbIface

AhbIface

AHB interface

CanDevIface

CanDevIface

CAN device interface.

DeviceIface

DeviceIface

Device interface.

MemAccessIface

MemAccessIface

Memory access interface for memory mapped registers.

ResetIface

ResetIface

Commands

Name Description

delete

Dispose instance of CAN_OC

Limitations

The following deviations from real hardware are known to exist with this model:

  • The controller clears the RX and TX buffers on reset. This is not the proper behavior and may have an impact on FDIR. Let us know if this is an issue.

  • There is no arbitration of messages in the simulated world and busses are not synchronised.

  • The model does at present not register filters with the CAN bus model.

  • The model currently ignores the error field in the CAN frame objects.

  • The model currently assumes the CAN bus is running at 1 Mb/s (this assumption is in non-infinite speed mode). This is arguably incorrect and the timing should be picked from the bus timing register Contact Terma if this is this is critical for your needs.