Page 14 of 56
Re: PCM Hammer fails on P12
Posted: Sun Feb 27, 2022 1:45 am
by Gampy
Changed my loop technique from,
Code: Select all
start:
clr.w %d0
wait01:
bsr.w ResetWatchdog
bsr.w WasteTime
addq.w #1, %d0
cmpi.w #1000, %d0
beq.w Exit1
jmp.s wait01
WasteTime:
nop
nop
nop
nop
rts
ResetWatchdog:
move.b #0x55, (0xFFFA55).l | Reset COP1
move.b #0xAA, (0xFFFA55).l
bclr #7, (0xFFFA21).l | Reset COP2
bset #7, (0xFFFA21).l
rts
Exit1:
.end
To,
Code: Select all
start:
clr.l %d0
wait01:
bsr.w ResetWatchdog
bsr.w WasteTime
addq.l #1, %d0
cmpi.l #1000, %d0
ble.s wait01
rts
WasteTime:
nop
nop
nop
nop
rts
ResetWatchdog:
move.b #0x55, (0xFFFA55).l | Reset COP1
move.b #0xAA, (0xFFFA55).l
bclr #7, (0xFFFA21).l | Reset COP2
bset #7, (0xFFFA21).l
rts
.end
And have a test out there ...
Re: PCM Hammer fails on P12
Posted: Sun Feb 27, 2022 4:09 am
by Gampy
A little gathering,
Everything I've done from the very beginning has always resulted in an Empty Buffer message ...
Until, I sent just an empty 'main()' for lack of a better term in C, Mode3680 responded with success (ack).
We kinda flipped to the code Antus posted and it again is back to a Buffer Empty message ...
Nothing since has responded with success, I'm sure it's just not liking something about the code.
Just got the results from a simple,
Got Buffer Empty ...
Just sent another test out,
My goal here is simply to see the ack from the 3680 ... As I did with the simple C routine.
The assembly of the simple C was simply a start and an rts ...
Re: PCM Hammer fails on P12
Posted: Sun Feb 27, 2022 10:32 am
by Gampy
Ok, got the ack with the last test ...
[06:08:53:388] TX: 6D 10 F0 36 80 00 0A FF 20 00 4E 71 4E 71 4E 71 4E 71 4E 75 05 68
[06:08:53:420] RX: 6C F0 10 76 00 73
[06:08:53:420] Found response, Success
[06:08:53:420] Kernel upload 100% complete.
[06:08:53:420] Kernel uploaded to PCM succesfully...
It appears the assembly code routine must end with rts, appropriately so I guess.
I now have a short loop out for testing (as posted two posts back), the goal now is to get a loop living longer then the Watchdog timeouts ...
Re: PCM Hammer fails on P12
Posted: Sun Feb 27, 2022 11:21 am
by antus
absolutely you need an rts. the compiler will give you one for free as it builds the program from from the c syntax and you have a function, thus you have an rts. the asm will not.
Re: PCM Hammer fails on P12
Posted: Sun Feb 27, 2022 12:24 pm
by Gampy
Ok the short loop (0xA count), survived, and got the ack.
A test is out extending the loop count, and I'm going to keep extending it as long as we keep getting an ack, at least until I'm sure it's beyond the COP timeout.
I like to eat one bite at a time ...
Re: PCM Hammer fails on P12
Posted: Sun Feb 27, 2022 12:36 pm
by Gampy
Ok, that survived, got the ack ... Next test is out.
Re: PCM Hammer fails on P12
Posted: Sun Feb 27, 2022 12:44 pm
by antus
c is like a asm macro language. rts is the opcode to return. the processor executes one opcode after the next. c and asm are not different, but as the implementer the C does some things for you - that means the ret and maybe pushing and poping registers to preserve them. Optimised C will take the push and pop out if they are not require. Un-optimised C probably doesnt. . I dont consider C source and Asm source a different approach, the result is the same. Just the asm is simpler to get exactly what your looking for. An empty function in C should be close to just a ret. Tough you need to disaseemble to know for sure. It might push and pop some registers as well, whereas asm will be more efficient and push and pop nothing by default as that is on the author of the code to do just whats needed. In this case, just ret, will leave the registers untouched. And perhaps that is part of this. Perhaps you do need to push and pop registers around your code. If you are using d0, maybe push it on entry and pop it before rts. I wish I had a pcm here to test with. To know for sure disasm the working C, reassemble it in asm then cut it back until you find out what makes the difference. then you know.
Re: PCM Hammer fails on P12
Posted: Sun Feb 27, 2022 1:42 pm
by Gampy
I wish I had one here as well ... Called my supplier, doesn't have one, has a 2004 Trailblazer 4.2L, we do not know if it's a P12, they say they are not interchangeable, but heck that could just mean it has the wrong firmware/calibrations.
Re: PCM Hammer fails on P12
Posted: Sun Feb 27, 2022 2:04 pm
by darkman5001
Gampy wrote:I wish I had one here as well ... Called my supplier, doesn't have one, has a 2004 Trailblazer 4.2L, we do not know if it's a P12, they say they are not interchangeable, but heck that could just mean it has the wrong firmware/calibrations.
2004 Trailblazer uses the P10 PCM.
Re: PCM Hammer fails on P12
Posted: Sun Feb 27, 2022 2:42 pm
by antus
a number of them come up on ebay searching for 12597521 but by the time I convert to $au and add another $60usd for postage, and consider its quoting 2 months to get here, it doesnt seem worth it for something which is just fun and games to me. I'll never use one of these on a car or on a project

Still interested to see if we can get some results though.