commaai/panda

returned address for forwarded messages different on H7 vs F4

Closed this issue · 1 comments

Close if we don't want to spend any time on this

Was confusing for Nick who was doing a car port, who's used to the three method of storing the returned bus. We should just pick one and stick with it.

bxcan stores the destination bus (CAN buffer number - 128 means delivered on bus 0):

panda/board/drivers/bxcan.h

Lines 136 to 141 in c118c28

to_push.returned = 1U;
to_push.rejected = 0U;
to_push.extended = (CANx->sTxMailBox[0].TIR >> 2) & 0x1U;
to_push.addr = (to_push.extended != 0U) ? (CANx->sTxMailBox[0].TIR >> 3) : (CANx->sTxMailBox[0].TIR >> 21);
to_push.data_len_code = CANx->sTxMailBox[0].TDTR & 0xFU;
to_push.bus = bus_number;

fdcan stores the source bus (CANPacket_t bus - 128 means origin is bus 0):

panda/board/drivers/fdcan.h

Lines 130 to 134 in c118c28

to_push.returned = 1U;
to_push.rejected = 0U;
to_push.extended = to_send.extended;
to_push.addr = to_send.addr;
to_push.bus = to_send.bus;

Let's fix this