STM32 and CAN BUS communication with cube black

I am planning to build a device using a stm32f4 and have said device communicating via CAN BUS with a cube black ,with arducopter installed.
Then the cube black would include this payload in the mavlink messages, so I can retrieve at the other end of telemetry. I have been reading the documentation about mavlink common, can bus in ardupilot, but I am not sure if this doable. Have anyone that tried something similar give a help or confirmation if this is possible?

What you probably want is an AP_Periph basis. My guess is that that is the exact basis that you need for you application.