libuav original

Dependents:   UAVCAN UAVCAN_Subscriber

Embed: (wiki syntax)

« Back to documentation index

CanIface Class Reference

CanIface Class Reference

Single CAN iface. More...

#include <can.hpp>

Inherits uavcan::ICanIface, and uavcan::Noncopyable.

Public Member Functions

int init (const uavcan::uint32_t bitrate, const OperatingMode mode)
 Initializes the hardware CAN controller.
void pollErrorFlagsFromISR ()
 This method is used to count errors and abort transmission on error if necessary.
uavcan::uint32_t getRxQueueOverflowCount () const
 Number of RX frames lost due to queue overflow.
virtual uavcan::uint64_t getErrorCount () const
 Total number of hardware failures and other kinds of errors (e.g.
uavcan::uint32_t getVoluntaryTxAbortCount () const
 Number of times the driver exercised library's requirement to abort transmission on first error.
unsigned getRxQueueLength () const
 Returns the number of frames pending in the RX queue.
bool hadActivity ()
 Whether this iface had at least one successful IO since the previous call of this method.
uavcan::uint8_t getPeakNumTxMailboxesUsed () const
 Peak number of TX mailboxes used concurrently since initialization.

Detailed Description

Single CAN iface.

The application shall not use this directly.

Definition at line 47 of file drivers/stm32/driver/include/uavcan_stm32/can.hpp.


Member Function Documentation

uavcan::uint64_t getErrorCount (  ) const [virtual]

Total number of hardware failures and other kinds of errors (e.g.

queue overruns). May increase continuously if the interface is not connected to the bus.

Implements ICanIface.

Definition at line 858 of file uc_stm32_can.cpp.

uavcan::uint8_t getPeakNumTxMailboxesUsed (  ) const

Peak number of TX mailboxes used concurrently since initialization.

Range is [1, 3]. Value of 3 suggests that priority inversion could be taking place.

Definition at line 227 of file drivers/stm32/driver/include/uavcan_stm32/can.hpp.

unsigned getRxQueueLength (  ) const

Returns the number of frames pending in the RX queue.

This is intended for debug use only.

Definition at line 864 of file uc_stm32_can.cpp.

uavcan::uint32_t getRxQueueOverflowCount (  ) const

Number of RX frames lost due to queue overflow.

This is an atomic read, it doesn't require a critical section.

Definition at line 195 of file drivers/stm32/driver/include/uavcan_stm32/can.hpp.

uavcan::uint32_t getVoluntaryTxAbortCount (  ) const

Number of times the driver exercised library's requirement to abort transmission on first error.

This is an atomic read, it doesn't require a critical section. See uavcan::CanIOFlagAbortOnError.

Definition at line 208 of file drivers/stm32/driver/include/uavcan_stm32/can.hpp.

bool hadActivity (  )

Whether this iface had at least one successful IO since the previous call of this method.

This is designed for use with iface activity LEDs.

Definition at line 870 of file uc_stm32_can.cpp.

int init ( const uavcan::uint32_t  bitrate,
const OperatingMode  mode 
)

Initializes the hardware CAN controller.

Assumes:

  • Iface clock is enabled
  • Iface has been resetted via RCC
  • Caller will configure NVIC by itself

Definition at line 563 of file uc_stm32_can.cpp.

void pollErrorFlagsFromISR (  )

This method is used to count errors and abort transmission on error if necessary.

This functionality used to be implemented in the SCE interrupt handler, but that approach was generating too much processing overhead, especially on disconnected interfaces.

Should be called from RX ISR, TX ISR, and select(); interrupts must be enabled.

Definition at line 777 of file uc_stm32_can.cpp.