MCP2515 PASM based SPI-engine object, trouble sending messages
Hi,
I have trouble sending CAN messages with this object.
The first transmitted message is almost correct except for the last byte, but the next ones are not even close to correct.
It looks like the pointer to DataBufferTx is only used the first time, then the adress to read from in ram is increased for each loop.
I have attached my code and a screenshot of what is received in the other end.
I guess the answer is simple, but I am totally stuck, does anyone else see what the problem is?

CAN test.spin
MCP2515-SPI Engine.spin
I have trouble sending CAN messages with this object.
The first transmitted message is almost correct except for the last byte, but the next ones are not even close to correct.
It looks like the pointer to DataBufferTx is only used the first time, then the adress to read from in ram is increased for each loop.
I have attached my code and a screenshot of what is received in the other end.
I guess the answer is simple, but I am totally stuck, does anyone else see what the problem is?

CAN test.spin
MCP2515-SPI Engine.spin

Comments
movs :SNxtLongI, #nIntrnlBffr0 nop :SNxtLongI mov arg0, nIntrnlBffr0 ' copy 1st word into location being sent mov nbrBits, #32 ' Load/reload number of data bits call #SendLong ' go send 32 bits add :SNxtLongI,#1 ' point to next COG long to be sent djnz bytXferCt,#:SNxtLongI ' if more longs to be sent, go do next and arg0, #1 wz,nr ' LS-bit of command indicates what we are sending if_nz jmp #:SendExit ' if short form (8vs13) then skip 13th byte mov arg0, nIntrnlBffr3 ' MS-8bits is 13th byte to be sent mov nbrBits, #8 ' Load number of data bits (send MS-8bits) ' mov msBitMask, #$08 ' Create MSB mask ; load with "1" ' rol msBitMask, #24 ' Shift "1" N number of bits to the left. mov msBitMask, #$80 call #WRnBITS