Skip to content

Commit

Permalink
Fix documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
duartegalvao committed Jul 2, 2020
1 parent eb26a55 commit 2c8e300
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ The original example contains code for the usage of only one of the two availabl

Atmel's ASF drivers for MCAN do not allow fine control of the baudrate parameters, so a patch is needed. The patch implemented here is based on the solution presented in @borkedLabs 2017 article: https://borkedlabs.com/blog/2017/09-24-samc21-same70-samv71-canbus-bosch-lessons-learned/

The patch affects the following files:
- `src/ASF/sam/drivers/mcan/mcan.h` (`mcan_set_baudrate` prototype)
- `src/ASF/sam/drivers/mcan/mcan.c` (`mcan_set_baudrate` and `_mcan_set_configuration`)

#### Bit timing values

Bit timing values, defined in `conf_mcan.h`, were obtained experimentally in order to achieve a 1Mbps baudrate.
Expand Down
5 changes: 4 additions & 1 deletion src/ASF/sam/drivers/mcan/mcan.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,10 @@ void mcan_init(struct mcan_module *const module_inst, Mcan *hw,
* \brief Set MCAN baudrate.
*
* \param[in] hw Pointer to the MCAN module instance
* \param[in] baudrate MCAN baudrate
* \param[in] nbrp MCAN baudrate pre-scaler
* \param[in] nsjw MCAN synchronization jump width (TQs)
* \param[in] ntseg1 MCAN segment 1 width (TQs)
* \param[in] ntseg2 MCAN segment 2 width (TQs)
*/
void mcan_set_baudrate(Mcan* hw, uint32_t nbrp, uint32_t nsjw, uint32_t ntseg1, uint32_t ntseg2)
{
Expand Down
2 changes: 1 addition & 1 deletion src/qs_mcan_basic.c
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ int main(void)
case '4':
printf(" 4: MCAN0 - Set extended filter ID 0: 0x100000A5, store into Rx buffer. \r\n");
mcan_set_extended_filter_0(&mcan0_instance);
break;
break;

case '5':
printf(" 5: MCAN0 - Set extended filter ID 1: 0x10000096, store into Rx FIFO 1. \r\n");
Expand Down

0 comments on commit 2c8e300

Please sign in to comment.