I have a problem in got can error type,
I had enable CAN error reg, and enable CAN modules.
such as, I creat NO-ACK error. then the error irq is got.however when i read ESR1, ERRINT is SET,but ACKERR is zero.
so.what should i do to get useful CAN error type.
thanks for you read.
Hi,
not sure what code you are using, but a reading of ESR1 will clear error status bits (BIT1ERR, BIT0ERR, ACKKERR, CRCERR, FRMERR and STFERR, and BIT1ERR_FAST, BIT0ERR_FAST, CRCERR_FAST, FRMERR_FAST and STFERR_FAST) so further reading will give you zero. It is recommended the CPU to use the following procedure when servicing interrupt requests generated by interrupt bits:
• Read this register to capture all error condition and status bits. This action clear the respective error status bits that were set since the last read access.
• Write 1 to clear the interrupt bit that has triggered the interrupt request.
• Write 1 to clear the ERR_OVR bit if it is set.
BR, Petr
HI:
thanks for you answer. I solved it.
I think the reason why i can't got error info is I read it for too much times in once.so i only get ERRINT flag.
however, i find another question. i have not connect MPC5748G to CAN bus,then i send CAN Frame.the error flag is STFERR? why not is ACKERR?
BR, helius
Hi,
can you share ECR/ESR1 values for this case? Normally txerror counter should be 0x80 and ACCERR set as you wrote. Try to check proper module clocking , CAN bit timing and transceiver connection.
BR, Petr