comparison packages/devs/can/arm/lpc2xxx/current/cdl/can_lpc2xxx.cdl @ 3348:4baa86091c2c

* cdl/can_lpc2xxx.cdl: Add CYGHWR_DEVS_CAN_LPC2XXX_BUSOFF_WORKAROUND to enable conditional Bus-Off reset mode workaround. [Bug 1001897] * src/can_lpc2xxx.c: Add function lpc2xxx_reset_error_counters to reset TX and RX error counters to certain values. Function lpc2xxx_start_module now clears both error counters. Add some LPC2XXX_DBG_PRINT statements to lpc2xxx_can_getevent function. Add function lpc2xxx_print_status to ease printing status register content. If a bus error condition occures (ICR_BUS_ERR) the function lpc2xxx_can_getevent now clears the error counters to prevent error ISR from blocking application and to support recovery from bus off condition if option CYGHWR_DEVS_CAN_LPC2XXX_BUSOFF_WORKAROUND is enabled.
author sergeig
date Wed, 18 Sep 2013 16:01:59 +0000
parents b8d91bac2ba8
children
comparison
equal deleted inserted replaced
3347:e0b2ee45abd2 3348:4baa86091c2c
326 levels, corresponding to the values 0 through 15 decimal, 326 levels, corresponding to the values 0 through 15 decimal,
327 of which 15 is the lowest priority. The reset value of 327 of which 15 is the lowest priority. The reset value of
328 these interrupt priority registers defaults all interrupts 328 these interrupt priority registers defaults all interrupts
329 to the lowest priority 15, allowing a single write to 329 to the lowest priority 15, allowing a single write to
330 elevate the priority of an individual interrupt." 330 elevate the priority of an individual interrupt."
331 }
332
333 # Enable this by default for "LPX22xx" parts only.
334 cdl_option CYGHWR_DEVS_CAN_LPC2XXX_BUSOFF_WORKAROUND {
335 display "Bus-Off Reset Mode workaround"
336 flavor bool
337 default_value { CYGHWR_HAL_ARM_LPC2XXX_VARIANT_VERSION == 2 }
338 description "
339 If the Transmit Error counter contains 255 and another
340 error occurs, the CAN Controller is forced into a state
341 called Bus-Off. In this state, the following register bits
342 and register values are set: BS (Bus Off Set) in CANxSR, BEI
343 (Bus Error Interrupt) and EI (Error Warning Interrupt) in
344 CANxICR, RM (Reset Mode) in CANxMOD, Transmit Error Counter
345 is set to 127, Receive Error Counter is cleared.
346 On some chips RM (Reset Mode) is not set and RX / TX error
347 counters are not cleared. This may lead to a permanent
348 re-calling of the Bus-Off error ISR which in turn may block
349 the application code from running. If this workaround is
350 active, the Bus-Off error ISR sets RM (Reset Mode), clears
351 RX / TX error counters."
331 } 352 }
332 353
333 cdl_option CYGPKG_DEVS_CAN_LPC2XXX_TESTS { 354 cdl_option CYGPKG_DEVS_CAN_LPC2XXX_TESTS {
334 display "CAN LPC2xxx device driver tests" 355 display "CAN LPC2xxx device driver tests"
335 flavor data 356 flavor data