CAN Driver Code from Harmony 2.06
I have zero experience with Microchip microcontrollers and my background is mainly in desktop software development. I am developing for a PIC32MZ1024EFF100 on a custom board. I am trying to use the MPLAB Harmony Configurator (v2.06) to generate boilerplate CAN Bus code. I have tried this once and I see CAN driver code, but it's not what I expect.
1) Is DRV_CAN0_ChannelMessageTransmit blocking code? If so, what happens if an interrupt for some other peripheral occurs while this is blocking? Will the CAN message be lost or garbled?
2) Is it possible to change Harmony Configurator input parameters to generate CAN Bus code that uses interrupts? Or should I poll by repeatedly calling DRV_CAN0_ChannelMessageReceive?
3) DRV_CAN0_ChannelMessageTransmit calls PLIB_CAN_TransmitBufferGet. Does the buffer returned by PLIB_CAN_TransmitBufferGet require an offset? If I change DRV_CAN0_ChannelMessageTransmit to use the same buffer twice in a row before flushing, will I lose the previous message I tried to transmit? Or is this safe if I call PLIB_CAN_ChannelUpdate in between?
4) How large does the buffer passed to PLIB_CAN_MemoryBufferAssign need to be? The comment in generated driver code above this call says it allows for 8 message buffers, but the actual buffer passed (can_message_buffer0) has an array size of 2*2*16. If there are separate buffers for transmit and receive (2x) and there are two channels (2x), then shouldn't the array size be 2*2*8? Also, how does this relate to the channel size (1) passed to PLIB_CAN_ChannelForTransmitSet? Shouldn't channel size be the same as the number of message buffers?