Skip to content

cpu/esp32: reimplementation of module esp_can as module periph can#11989

Merged
vincent-d merged 5 commits intoRIOT-OS:masterfrom
gschorcht:cpu/esp32/periph-can
Sep 23, 2019
Merged

cpu/esp32: reimplementation of module esp_can as module periph can#11989
vincent-d merged 5 commits intoRIOT-OS:masterfrom
gschorcht:cpu/esp32/periph-can

Conversation

@gschorcht
Copy link
Copy Markdown
Contributor

Contribution description

This PR is a refactoring of the ESP32 CAN controller driver implementation. Refactoring became necessary to follow the approach as introduced with PR #6178, which defines CAN interfaces as peripherals with automatic configuration.

Accordingly, the ESP32 CAN controller driver is no longer a separate module (esp_can), but rather part of the peripheral drivers which is enabled when module periph_can is used.

Testing procedure

For testing, an ESP32 board with a connected CAN transceiver module is required. The only supported board is which already has such a CAN transceiver module on board, is the Olimex ESP32-EVB. Therefore, it is suggested to use this board.

After flashing the board with application tests/conn_can

make BOARD=esp32-olimex-evb -C tests/conn_can flash term

the CAN-L and CAN-H have to be connected to a can bus. As counterpart a Linux box should be used with the can-utils.

linux> sudo ip link set can0 type can bitrate 500000
linux> sudo ip link set can0 up

After connecting to the ESP32 board in a terminal, the following tests can be executed.

  1. List CAN interfaces:
    esp32> can list
    CAN #0: esp-can
    
  2. Send a CAN frame from ESP32 to the Linux box (start candump first):
    linux$ candump can0
     
    can0  123   [4]  11 22 33 44
    
    esp32> can send 0 123 11 22 33 44
    
  3. Send a CAN frame from Linux box to ESP32 (start can dump first and send within 10 seconds):
    esp32> can dump 0 0 10000
    esp-can (0)      5A1  [8]  11 22 33 44 55 66 77 88
    
    linux$ cansend can0 5A1#11.2233.44556677.88
    

Issues/PRs references

Implements #6178 for ESP32.

@gschorcht gschorcht requested a review from vincent-d August 9, 2019 16:00
@gschorcht gschorcht added Area: cpu Area: CPU/MCU ports Area: drivers Area: Device drivers Platform: ESP Platform: This PR/issue effects ESP-based platforms Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Aug 9, 2019
@gschorcht gschorcht added this to the Release 2019.10 milestone Sep 5, 2019
@gschorcht
Copy link
Copy Markdown
Contributor Author

@vincent-d Will it be possible for you to review this PR?

@vincent-d
Copy link
Copy Markdown
Member

Looks good to me. I can't test it and it needs a rebase. I'll ACK once it's rebased.

@gschorcht
Copy link
Copy Markdown
Contributor Author

@vincent-d Thanks for reviewing. I have rebased the PR. I don't know someone else of RIOT maintainers who has the right hardware (Olimex ESP32 EVB for example) to test it.

@gschorcht
Copy link
Copy Markdown
Contributor Author

@yegorich Do you have the hardware?

@yegorich
Copy link
Copy Markdown
Contributor

@gschorcht I have Olimex ESP32 EVB and will try to test your PR next week.

@yegorich
Copy link
Copy Markdown
Contributor

yegorich commented Sep 23, 2019

I could test this PR using the above-mentioned commands on an Olimex ESP32 EVB board against a VScom USB-CAN Plus adapter.

Copy link
Copy Markdown
Member

@vincent-d vincent-d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK

@vincent-d vincent-d merged commit 1a44d32 into RIOT-OS:master Sep 23, 2019
@gschorcht gschorcht deleted the cpu/esp32/periph-can branch October 4, 2019 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: cpu Area: CPU/MCU ports Area: drivers Area: Device drivers CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Platform: ESP Platform: This PR/issue effects ESP-based platforms Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants