Skip to content

Wrong CAN_PARAM_MAP Mapping for SlCan although configuration file OK #217

@SaxElectronics

Description

@SaxElectronics

Hi @christoph2 ,

I discovered an issue while trying to update my project to the latest pyxcp master.

The issue is happening here, when passing the parameters for Python Can Wrapper:
self.can_interface = PythonCanWrapper(self, self.interface_name, config.timeout, **parameters)
However the actual problem is in:

get_interface_parameters

My configuration is:

#
# Configuration file for pyXCP.
#
c = get_config()  # noqa

# ------------------------------------------------------------------------------
# Transport configuration
# ------------------------------------------------------------------------------

# Choose one of the supported XCP transport layers.
c.Transport.layer = "CAN"

# Alignment border.
c.Transport.alignment = 8

# raise `XcpTimeoutError` after `timeout` seconds if there is no response to a command.
c.Transport.timeout = 3.0

# Record time of frame reception or set timestamp to 0.
c.Transport.create_daq_timestamps = False

# ------------------------------------------------------------------------------
# General configuration
# ------------------------------------------------------------------------------

# Ignore missing response on DISCONNECT request.
c.General.disconnect_response_optional = False

# ------------------------------------------------------------------------------
# Application configuration
# ------------------------------------------------------------------------------

# Set the log level by value or name.
c.Application.log_level = "DEBUG"

# ------------------------------------------------------------------------------
# Transport.Can configuration
# ------------------------------------------------------------------------------

# CAN interface supported by python-can
c.Transport.Can.interface = "slcan"

# Enable self-reception of sent messages.
c.Transport.Can.use_default_listener = True

# Channel identification. Expected type and value is backend dependent.
c.Transport.Can.channel = "COM5"

# CAN bitrate in bits/s (arbitration phase, if CAN FD).
c.Transport.Can.bitrate = 500000

# CAN-ID master -> slave (Bit31= 1: extended identifier)
c.Transport.Can.can_id_master = 0x04

# CAN-ID slave -> master (Bit31= 1: extended identifier)
c.Transport.Can.can_id_slave = 0x03

# Auto detection CAN-ID (Bit31= 1: extended identifier)
c.Transport.Can.can_id_broadcast = 0xF4

# Master to slave frames always to have DLC = MAX_DLC = 8
c.Transport.Can.max_dlc_required = False

# One CAN identifier per DAQ-list.
c.Transport.Can.daq_identifier = [0x5, 0x6, 0x7]

# Bus timing value tseg1 (arbitration, TSEG1 if CAN classic).
c.Transport.Can.tseg1_abr = 8

# Bus timing value tseg2 (arbitration, TSEG2, if CAN classic)
c.Transport.Can.tseg2_abr = 4

# Bus timing value sample jump width (arbitration, SJW if CAN classic).
c.Transport.Can.sjw_abr = 4

However the CAN_PARAM_MAP for SlCan maps these config parameters to None, and therefore PythonCanWrapper is receiving "None" Parameters and failing.

 CAN_PARAM_MAP = {
        "sjw_abr": None,
        "tseg1_abr": None,
        "tseg2_abr": None,
        "sjw_dbr": None,
        "tseg1_dbr": None,
        "tseg2_dbr": None,
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions