CANFD fixes.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@13466 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
Giovanni Di Sirio 2020-03-21 08:20:51 +00:00
parent eea9a7a9d7
commit 85ad133346
2 changed files with 8 additions and 0 deletions

View File

@ -279,6 +279,7 @@ bool can_lld_start(CANDriver *canp) {
canp->fdcan->CCCR |= FDCAN_CCCR_CCE;
/* Setting up operation mode except driver-controlled bits.*/
canp->fdcan->NBTP = canp->config->NBTP;
canp->fdcan->DBTP = canp->config->DBTP;
canp->fdcan->CCCR = canp->config->CCCR & ~(FDCAN_CCCR_CSR | FDCAN_CCCR_CSA |
FDCAN_CCCR_CCE | FDCAN_CCCR_INIT);
@ -387,6 +388,9 @@ void can_lld_transmit(CANDriver *canp,
for (unsigned i = 0U; i < dlc_to_bytes[ctfp->DLC]; i += 4U) {
*tx_address++ = ctfp->data32[i / 4U];
}
/* Starting transmission.*/
canp->fdcan->TXBAR = (uint32_t)1 << (uint32_t)mailbox;
}
/**

View File

@ -304,6 +304,10 @@ typedef struct {
* @brief Driver configuration structure.
*/
typedef struct {
/**
* @brief Nominal bit timing and prescaler register.
*/
uint32_t NBTP;
/**
* @brief Data bit timing and prescaler register.
*/