PCM Hammer P12 development

They go by many names, P01, P10, P12, P59, E38, VPW, '0411 etc.
User avatar
Gampy
Posts: 2332
Joined: Sat Dec 15, 2018 7:38 am

Re: PCM Hammer fails on P12

Post 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 ...
Intelligence is in the details!

It is easier not to learn bad habits, then it is to break them!

If I was here to win a popularity contest, their would be no point, so I wouldn't be here!
User avatar
Gampy
Posts: 2332
Joined: Sat Dec 15, 2018 7:38 am

Re: PCM Hammer fails on P12

Post 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,

Code: Select all

start:
  nop
  nop
.end
Got Buffer Empty ...
Just sent another test out,

Code: Select all

start:
    nop
    nop
    rts
.end
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 ...
Intelligence is in the details!

It is easier not to learn bad habits, then it is to break them!

If I was here to win a popularity contest, their would be no point, so I wouldn't be here!
User avatar
Gampy
Posts: 2332
Joined: Sat Dec 15, 2018 7:38 am

Re: PCM Hammer fails on P12

Post 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 ...
Intelligence is in the details!

It is easier not to learn bad habits, then it is to break them!

If I was here to win a popularity contest, their would be no point, so I wouldn't be here!
User avatar
antus
Site Admin
Posts: 9017
Joined: Sat Feb 28, 2009 8:34 pm
cars: TX Gemini 2L Twincam
TX Gemini SR20 18psi
Datsun 1200 Ute
Subaru Blitzen '06 EZ30 4th gen, 3.0R Spec B
Contact:

Re: PCM Hammer fails on P12

Post 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.
Have you read the FAQ? For lots of information and links to significant threads see here: http://pcmhacking.net/forums/viewtopic.php?f=7&t=1396
User avatar
Gampy
Posts: 2332
Joined: Sat Dec 15, 2018 7:38 am

Re: PCM Hammer fails on P12

Post 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 ...
Intelligence is in the details!

It is easier not to learn bad habits, then it is to break them!

If I was here to win a popularity contest, their would be no point, so I wouldn't be here!
User avatar
Gampy
Posts: 2332
Joined: Sat Dec 15, 2018 7:38 am

Re: PCM Hammer fails on P12

Post by Gampy »

Ok, that survived, got the ack ... Next test is out.
Intelligence is in the details!

It is easier not to learn bad habits, then it is to break them!

If I was here to win a popularity contest, their would be no point, so I wouldn't be here!
User avatar
antus
Site Admin
Posts: 9017
Joined: Sat Feb 28, 2009 8:34 pm
cars: TX Gemini 2L Twincam
TX Gemini SR20 18psi
Datsun 1200 Ute
Subaru Blitzen '06 EZ30 4th gen, 3.0R Spec B
Contact:

Re: PCM Hammer fails on P12

Post 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.
Have you read the FAQ? For lots of information and links to significant threads see here: http://pcmhacking.net/forums/viewtopic.php?f=7&t=1396
User avatar
Gampy
Posts: 2332
Joined: Sat Dec 15, 2018 7:38 am

Re: PCM Hammer fails on P12

Post 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.
Intelligence is in the details!

It is easier not to learn bad habits, then it is to break them!

If I was here to win a popularity contest, their would be no point, so I wouldn't be here!
darkman5001
Posts: 252
Joined: Sat Dec 18, 2021 8:15 am
cars: 2005 Yukon, 2004 Suburban, 2001 Tahoe, 2002 Envoy, 2006 Envoy, 2003 Lincoln LS
Location: New Jersey, USA

Re: PCM Hammer fails on P12

Post 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.
User avatar
antus
Site Admin
Posts: 9017
Joined: Sat Feb 28, 2009 8:34 pm
cars: TX Gemini 2L Twincam
TX Gemini SR20 18psi
Datsun 1200 Ute
Subaru Blitzen '06 EZ30 4th gen, 3.0R Spec B
Contact:

Re: PCM Hammer fails on P12

Post 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.
Have you read the FAQ? For lots of information and links to significant threads see here: http://pcmhacking.net/forums/viewtopic.php?f=7&t=1396
Post Reply