Hi Kerry
Thanks for getting back to me.
For the easy answers. Yes I did follow the procedure the procedure that you reference from the manual including entering freeze mode before making the changes.
As for your question "Are you sure "CAN_MCR[RFEN]" isn't set?" - will have to do a double and check and let you know about that one as well as your other questions in your first post. In regards to the clocks being set, that I can say yes they are set for sure.
Thanks
Mike
EDIT:
In the app after setting the clocks (know this works - the sdk example works on my hardware). I do a call to:
FLEXCAN_FDInit(EXAMPLE_CAN, &flexcanConfig, EXAMPLE_CAN_CLK_FREQ, BYTES_IN_MB, true);
After that I do a call to my function:
FLEXCAN_SetRxEnhancedFifoConfig(EXAMPLE_CAN, true);
With that function looking like:
void FLEXCAN_SetRxEnhancedFifoConfig(CAN_Type *base, bool enable)
{
Serial.println("Entered FIFO Config");
//only valid for Flexcan3..........
/* Assertion. */
//assert((config) || (false == enable));
/* Enter Freeze Mode. */
FLEXCAN_EnterFreezeMode(base);
Serial.println("Entered Freeze Mode");
if (enable)
{
Serial.println(CAN_ERFCR_ERFEN(1), BIN);
delay(5000);
Serial.println(base->ERFCR,BIN);
delay(5000);
base->ERFCR |= CAN_ERFCR_ERFEN(1); //Enable enhanced FIFO <======= Dies here......
Serial.println(base->ERFCR,BIN);
delay(5000);
FLEXCAN3_ERFSR = CAN_ERFSR_ERFCLR(1); //Reset RxFIFO engine
//Clear EFRSR bits
FLEXCAN3_ERFSR = CAN_ERFSR_ERFUFW(0) | CAN_ERFSR_ERFOVF(0) | CAN_ERFSR_ERFWMI(0) | CAN_ERFSR_ERFDA(0);
FLEXCAN3_ERFCR |= CAN_ERFCR_NFE(2); //Configure total number of Rx FIFO filter elements
FLEXCAN3_ERFCR |= CAN_ERFCR_NEXIF(3); // number of extended ID & standard ID filter elements
FLEXCAN3_ERFCR |= CAN_ERFSR_ERFWMI(1); // number of messages in FIFO greater than the watermark
FLEXCAN3_ERFIER = 0x01; // Enable interrupts if they are to be used
// TBD // Enable DMA operation in MCR[DMA]
//FLEXCAN3_ERFCR |= CAN_ERFCR_DMALW(1); // to configure number of words to be transfered for each data element
//Configure filter elements by writing to the ERFFELn registers?
//FLEXCAN3_ERFFEL0...127
Serial.println("Registers setup");
flexcan_fd_fifo_filter_b01_t b01;
b01.fsch = 0b01;
//b01.RTRfilt = 0;
b01.std_id_flt1 = 0x000;
//b01.RTRmsk = 0;
b01.std_id_flt1 = 0x650;
FLEXCAN3_ERFFEL0 = CAN_ERFFEL_FEL(&b01);
FLEXCAN3_ERFFEL1 = CAN_ERFFEL_FEL(&b01);
}
/* Exit Freeze Mode. */
FLEXCAN_ExitFreezeMode(base);
FLEXCAN_EnableEnhancedFIFOInterrupts();
}