Skip to content

Commit

Permalink
pandad: set CAN FD auto mode (commaai#34076)
Browse files Browse the repository at this point in the history
* pandad: set CAN FD auto mode

* bump
  • Loading branch information
adeebshihadeh authored Nov 21, 2024
1 parent b0699cc commit 5131c19
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions selfdrive/pandad/panda.cc
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ void Panda::set_can_speed_kbps(uint16_t bus, uint16_t speed) {
handle->control_write(0xde, bus, (speed * 10));
}

void Panda::set_can_fd_auto(uint16_t bus, bool enabled) {
handle->control_write(0xe8, bus, enabled);
}

void Panda::set_data_speed_kbps(uint16_t bus, uint16_t speed) {
handle->control_write(0xf9, bus, (speed * 10));
}
Expand Down
1 change: 1 addition & 0 deletions selfdrive/pandad/panda.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class Panda {
void enable_deepsleep();
void send_heartbeat(bool engaged);
void set_can_speed_kbps(uint16_t bus, uint16_t speed);
void set_can_fd_auto(uint16_t bus, bool enabled);
void set_data_speed_kbps(uint16_t bus, uint16_t speed);
void set_canfd_non_iso(uint16_t bus, bool non_iso);
void can_send(const capnp::List<cereal::CanData>::Reader &can_data_list);
Expand Down
4 changes: 4 additions & 0 deletions selfdrive/pandad/pandad.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ Panda *connect(std::string serial="", uint32_t index=0) {
}
//panda->enable_deepsleep();

for (int i = 0; i < PANDA_BUS_CNT; i++) {
panda->set_can_fd_auto(i, true);
}

if (!panda->up_to_date() && !getenv("BOARDD_SKIP_FW_CHECK")) {
throw std::runtime_error("Panda firmware out of date. Run pandad.py to update.");
}
Expand Down

0 comments on commit 5131c19

Please sign in to comment.