Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion drivers/stm32g4_fdcan/canard_stm32g4_fdcan.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,10 @@ int canard_stm32g4fdcan_init(canard_stm32g4_fdcan_driver *driver, int bitrate_bp
* - on fifo0/1 received/lost
* - on bus-off */
/* bus-off | rx1 lost | rx1 new | rx0 lost | rx0 new */
fdcan->IE = (1 << 19) | (1 << 5) | (1 << 3) | (1 << 2) | (1 << 0);
fdcan->IE = (1 << 19) | (1 << 5) | (1 << 3) | (1 << 2) | (1 << 0);
fdcan->ILS = 0; /* all interrupts on line 0 */
fdcan->ILE = (1 << 0); /* enable line 0 */

driver->fdcan_sram = (void *) fdcan_ram(fdcan);
memset(driver->fdcan_sram, 0, sizeof(fdcan_sram));
return 0;
Expand Down Expand Up @@ -182,6 +185,11 @@ void canard_stm32g4fdcan_start(canard_stm32g4_fdcan_driver *driver)
while ((fdcan->CCCR & (1 << 0))); /* Wait until we leave init mode */
}

uint32_t canard_stm32g4fdcan_get_base_addr(const canard_stm32g4_fdcan_driver *driver)
{
return (uint32_t) driver->fdcan;
}

int canard_stm32g4fdcan_transmit(canard_stm32g4_fdcan_driver *driver, const CanardCANFrame* const frame)
{
clear_and_handle_faults(driver);
Expand Down
5 changes: 5 additions & 0 deletions drivers/stm32g4_fdcan/canard_stm32g4_fdcan.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ int canard_stm32g4fdcan_init(canard_stm32g4_fdcan_driver *driver, int bitrate_bp
*/
void canard_stm32g4fdcan_start(canard_stm32g4_fdcan_driver *driver);

/**
* Returns the base address of the FDCAN peripheral in the driver.
*/
uint32_t canard_stm32g4fdcan_get_base_addr(const canard_stm32g4_fdcan_driver *driver);

/**
* Creates a filter based on broadcast message IDs. Pass DroneCAN message IDs to create a filter.
* Due to internal organization, these filters come in pairs: just set to 0 if not needed.
Expand Down
Loading