Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support sccan #5

Merged
merged 9 commits into from
Oct 23, 2023
Merged

Support sccan #5

merged 9 commits into from
Oct 23, 2023

Conversation

sasataku
Copy link
Member

This PR support SC CAN driver for SC-Sat1 MAIN board.

This PR is implemented based on the SC CAN controller IP specification below.
https://github.com/spacecubics/scobc-fpga-technical-reference-manual/blob/main/can_controller.org

However now we plant to update the SC CAN controller IP for some improving.

@sasataku sasataku requested review from fmorishima and yashi July 28, 2023 06:26
main/app.overlay Outdated Show resolved Hide resolved
main/Kconfig Outdated Show resolved Hide resolved
main/app.overlay Outdated Show resolved Hide resolved
zephyr/drivers/can/can_sccan.c Outdated Show resolved Hide resolved
zephyr/drivers/can/can_sccan.c Outdated Show resolved Hide resolved
zephyr/drivers/can/can_sccan.c Outdated Show resolved Hide resolved
zephyr/drivers/can/can_sccan.c Outdated Show resolved Hide resolved
zephyr/drivers/can/can_sccan.c Outdated Show resolved Hide resolved
zephyr/drivers/can/can_sccan.c Outdated Show resolved Hide resolved
zephyr/drivers/can/can_sccan.c Outdated Show resolved Hide resolved
zephyr/drivers/can/can_sccan.c Show resolved Hide resolved
zephyr/drivers/can/can_sccan.c Outdated Show resolved Hide resolved
zephyr/drivers/can/can_sccan.c Outdated Show resolved Hide resolved
zephyr/drivers/can/can_sccan.c Outdated Show resolved Hide resolved
zephyr/drivers/can/can_sccan.c Show resolved Hide resolved
zephyr/drivers/can/can_sccan.c Outdated Show resolved Hide resolved
zephyr/drivers/can/can_sccan.c Show resolved Hide resolved
So far, We use dts overlay based on SC-OBC Module A1 for SC-Sat1
MAIN board.
However, we decided to prepare the new dts for SC-at1 MAIN board.
Later we will prepare for SC-Sat1 ADCS boards.

Signed-off-by: Takuya Sasaki <takuya.sasaki@spacecubics.com>
This commit adds CAN definition for MAIN board.

Signed-off-by: Takuya Sasaki <takuya.sasaki@spacecubics.com>
zephyr/drivers/can/can_sccan.c Outdated Show resolved Hide resolved
zephyr/drivers/can/can_sccan.c Outdated Show resolved Hide resolved
zephyr/drivers/can/can_sccan.c Outdated Show resolved Hide resolved
@sasataku sasataku force-pushed the support-sccan branch 2 times, most recently from bfd2719 to 78bd472 Compare August 7, 2023 08:12
zephyr/drivers/can/can_sccan.c Outdated Show resolved Hide resolved
@spacecubics spacecubics deleted a comment from yashi Aug 21, 2023
zephyr/drivers/can/can_sccan.c Outdated Show resolved Hide resolved
Copy link
Member

@yashi yashi left a comment

Choose a reason for hiding this comment

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

Now I'm starting to do sematic checks. This one is mainly about the mutex, but has some others as well.

zephyr/drivers/can/can_sccan.c Outdated Show resolved Hide resolved
zephyr/drivers/can/can_sccan.c Outdated Show resolved Hide resolved
zephyr/drivers/can/can_sccan.c Outdated Show resolved Hide resolved
zephyr/drivers/can/can_sccan.c Outdated Show resolved Hide resolved
zephyr/drivers/can/can_sccan.c Outdated Show resolved Hide resolved
zephyr/drivers/can/can_sccan.c Outdated Show resolved Hide resolved
zephyr/drivers/can/can_sccan.c Outdated Show resolved Hide resolved
zephyr/drivers/can/can_sccan.c Show resolved Hide resolved
zephyr/drivers/can/can_sccan.c Outdated Show resolved Hide resolved
zephyr/drivers/can/can_sccan.c Outdated Show resolved Hide resolved
zephyr/drivers/can/can_sccan.c Outdated Show resolved Hide resolved
zephyr/drivers/can/can_sccan.c Outdated Show resolved Hide resolved
zephyr/drivers/can/can_sccan.c Outdated Show resolved Hide resolved
This commit adds Space Cubics CAN driver, but only implement the API
below.

  - init
  - start
  - stop
  - set_timing
  - recover (do nothing)
  - get_core_clock

And adds the dts overlay file for SC-Sat1 MAIN board.
SC-Sat1 MAIN board have three CAN interface.
ADCS boards also have CAN interface, but add later.

Signed-off-by: Takuya Sasaki <takuya.sasaki@spacecubics.com>
This commit implement can_send API for Space Cubics CAN.

In the current FPA CAN IP core, CAN Packets stored in the TX Buffer
transmit to the CAN Bus in a FIFO (First In First Out).
Therefore, there is no issue with managing the list of TX callbacks
using an array.
However, due to future modifications in the FPGA CAN IP core, the
transmission order of CAN Packets stored in the TX buffer will be
rearranged based on the CAN ID (priority).
So, we will need to change the management of TX callbacks from an
array to something like an slist.

And SC CAN Controller notify the interrupt every times while ACK
error detected, so this driver received the many interrupt.
we also plan to improve the Interrupt Status Register

Signed-off-by: Takuya Sasaki <takuya.sasaki@spacecubics.com>
This commit implement RX API for Space Cubics CAN.

Signed-off-by: Takuya Sasaki <takuya.sasaki@spacecubics.com>
This commit adds CAN status API as below.

  - can_get_state

Signed-off-by: Takuya Sasaki <takuya.sasaki@spacecubics.com>
This commit implements CAN mode related API as below.

  - sc_can_set_mode
  - sc_can_get_capabilities

SC CAN controller supports NORMAL and LOOPBACK only.

Signed-off-by: Takuya Sasaki <takuya.sasaki@spacecubics.com>
This commit enables CAN driver on SC-Sat1 MAIN board.

Signed-off-by: Takuya Sasaki <takuya.sasaki@spacecubics.com>
This commit adds description of "How to build the ztest".

Signed-off-by: Takuya Sasaki <takuya.sasaki@spacecubics.com>
@sasataku sasataku merged commit 7f65ef0 into main Oct 23, 2023
2 checks passed
@sasataku sasataku deleted the support-sccan branch October 23, 2023 01:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants