Skip to content

Commit

Permalink
fix: start the MCP2515 in normal mode for uds protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
AdonaiDiazEsparza committed Dec 9, 2024
1 parent 9a100fa commit 1280df5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Canbus_app/libraries/uds_library.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ UDS_SERVICE* uds_service_alloc(
// Init the mcp2515 with it respeclty mask and filters
bool uds_init(UDS_SERVICE* uds_instance) {
MCP2515* CAN = uds_instance->CAN;
CAN->mode = MCP_NORMAL;
if(mcp2515_init(CAN) != ERROR_OK) return false;

uint32_t mask = 0x7ff;
Expand All @@ -28,9 +29,13 @@ bool uds_init(UDS_SERVICE* uds_instance) {

init_mask(CAN, 0, mask);
init_filter(CAN, 0, uds_instance->id_to_received);
init_filter(CAN, 1, uds_instance->id_to_received);

init_mask(CAN, 1, mask);
init_filter(CAN, 1, uds_instance->id_to_received);
init_filter(CAN, 2, uds_instance->id_to_received);
init_filter(CAN, 3, uds_instance->id_to_received);
init_filter(CAN, 4, uds_instance->id_to_received);
init_filter(CAN, 5, uds_instance->id_to_received);

return true;
}
Expand Down

0 comments on commit 1280df5

Please sign in to comment.