Skip to content

Why was _nodma used in the SWCAN implementation, and is it still necessary? #1101

Open
@Donovan22

Description

@Donovan22

OVMS won't build when _nodma is included in components/swcan/swcan.cpp, components/swcan/swcan.h, and main/ovms_peripheral.cpp. The error says "undefined type spi_nodma_host_device_t". The only references I can find to spi having dma disabled on an esp32 is an obscure project from 2018.

To resolve this, I removed all _nodma references and switched to the standard SPI driver. This fixed the compilation issue but then there was a related runtime issue with chip select (CS) pins. (when SWCAN (can4) was enabled, the system ran out of available CS pins because can3 was also being initialized)

To address this:
I modified ovms_peripherals.cpp to conditionally initialize can3 only when SWCAN is disabled.
This freed up resources, allowing can4 to initialize correctly when SWCAN was enabled.

Questions:
What was the original purpose of _nodma in this context? Was it intended for compatibility or performance reasons?
Could removing _nodma cause any regressions or unexpected behavior, especially in high-speed or resource-intensive scenarios?
Is there a better solution to manage the CS pin limitation, or does this approach of conditionally initializing can3 seem appropriate?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions