FDCAN with STM32H735 Topic is solved

Report here problems in any of ChibiOS components. This forum is NOT for support.
User avatar
alex31
Posts: 386
Joined: Fri May 25, 2012 10:23 am
Location: toulouse, france
Has thanked: 39 times
Been thanked: 63 times
Contact:

Re: FDCAN with STM32H735

Postby alex31 » Wed May 15, 2024 2:04 pm

Hello, just tried your driver, saw one problem : there is a call to sleep in a lock zone, which is forbidden and sysHalt at exec when DEBUG is enabled.
Will comment the sleep and try to go further.
Alexandre

Code: Select all

void can_lld_transmit(CANDriver *canp, canmbx_t mailbox, const CANTxFrame *ctfp) {
  uint32_t put_index = 0;
  uint32_t *tx_address = 0;

  (void)mailbox;

  osalDbgCheck(dlc_to_bytes[ctfp->DLC] <= CAN_MAX_DLC_BYTES);

  /* Retrieve the TX FIFO put index.*/
  put_index = ((canp->fdcan->TXFQS & FDCAN_TXFQS_TFQPI) >> FDCAN_TXFQS_TFQPI_Pos);

  /* Writing frame. */
  tx_address = canp->ram_base + (SRAMCAN_TBSA + (put_index * canp->word_size));

  *tx_address++ = ctfp->header32[0];
  *tx_address++ = ctfp->header32[1];
  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 << put_index);
  /*
   * FIXME This sleep not needed if we send two frames with different SID/EID
   *       why?
   */
  osalThreadSleepMilliseconds(1);
}

User avatar
Giovanni
Site Admin
Posts: 14462
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1078 times
Been thanked: 922 times
Contact:

Re: FDCAN with STM32H735

Postby Giovanni » Wed May 15, 2024 2:15 pm

Running the code with the state checker should catch this.

Giovanni

User avatar
alex31
Posts: 386
Joined: Fri May 25, 2012 10:23 am
Location: toulouse, france
Has thanked: 39 times
Been thanked: 63 times
Contact:

Re: FDCAN with STM32H735

Postby alex31 » Wed May 15, 2024 4:01 pm

Yes, it does, state checker has saved me so many times :-) it's one of the many cool features of ChibiOS.
I enable it by default.


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 6 guests