I have some problems with CANbus. I try to add basic CANbus to project Plane
I have two functions. First one init for CAN
uint8_t _driver_index = 0;
uint8_t _interface = 0;
uavcan::ICanDriver* _can_driver;
AP_HAL::CANManager* can_mgr = new ChibiOS::CANManager;
void Plane::init(void)
{
const_cast <AP_HAL::HAL&> (hal).can_mgr[_driver_index] = can_mgr;
can_mgr->begin(1000000, _interface);
can_mgr->initialized(true);
}
void Plane::CANTransmit()
{
uavcan::CanFrame frame;
uavcan::MonotonicTime timeout = uavcan::MonotonicTime::fromUSec(AP_HAL::millis() + 500);
int16_t res2 = _can_driver->getIface(_interface)->send(frame, timeout, 0);
if (res2 == 1) {
return;
}
}
code build - OK, but autopilot reboots every 2-3 seconds.
Also i dont see anything in the terminal (use PCAN-USB Adapter and PCAN-View)
the main task, I want to transmit messages by CANbus
One more question, While using PCAN-View I can see some messages from CAN, what this messages mean?