Fully-modified 20b



#25

I just did the full set of modifications to my 20b:

  • JTAG interface
  • RS-232 level shifter
  • Clock crystal

I've got some photos:


Full board:


Closeup of level shifter:

It's not quite as crooked as it looks in the photo. It's a little off (long story...), but it's close enough that nothing is connected wrong.


Closeup of crystal:

Note that the schematics from HP are wrong -- 15 nF capacitors would be the wrong value; I used 18 pF capacitors (three orders of magnitude different!).


Unfortunately, I am having a problem.

I bought the SAM-ICE to use as a JTAG interface to connect to the 20b. I installed the latest software from Segger on my computer (Windows Vista x64). When I run the J-Flash ARM software and try to connect to the 20b, I get the following error:

Could not find supported CPU core on JTAG chain
Bad JTAG communication: Write to IR: Expected 0x1, got 0x7
(TAP Command : 2) @ Off 0x5.
Failed to connect

Any idea what that means? I am running the following software:

Segger J-Flash ARM V3.90
Compiled 11:34:57 on Aug 12

(Apparently it was just posted earlier today!)

I suppose this is mainly directed at Cyrille, but if anyone else here has successfully connected to the 20b with a SAM-ICE, I'd like to hear your experiences.

The solder joints are all perfect, so I am thinking this is a software misconfiguration, but maybe I got something wrong.


#26

Please tell us in simple terms what these modifications do to your souped-up 20b :-)


#27

Quote:
Please tell us in simple terms what these modifications do to your souped-up 20b :-)

JTAG interface: Allows debugging from a computer.

Crystal: Makes the real-time clock much more accurate. The built-in RC oscillator can vary by 10 kHz; this will remain a fairly steady 32 kHz.

Level shifter: Makes the serial port TX and RX lines use signal levels compatible with real RS-232 for communication with a computer or whatever. Instead of the signal being something like 0 to +3 volts it should now be closer to -5 to +5 volts.

#28

Did you hold down a key while attempting to establish the connection? It looks like your JTAG device is attempting to connect to the CPU while it's halted.

I've mentioned this before, but I like to put the calc in test mode, turn Tsys on (prevents the CPU from sleeping), go to one of the scrolling menus (display test, for example), and only then fire up the debugger.

Nice work on the upgrades!


#29

hello Eric,

as pointed out by scott, you can not connect if the CPU is not turned ON (and by default, it is off unless you are pressing on a key or in the test system is turned on....

I find that the best thing to do is to erase the flash before connecting with JTAG in order to force SAM-BA working (which does not turn off the CPU)..

regards, cyrille


#30

Quote:
I find that the best thing to do is to erase the flash before connecting with JTAG in order to force SAM-BA working (which does not turn off the CPU)..

Seeing as I've already erased the flash, maybe I am in good shape. :)

How do I use SAM-BA? So now that I've erased the flash, I am always in SAM-BA mode whenever the batteries are in, right?

When I run SAM-BA (from AT91-ISP version 1.12), it gives me the same "Could not find supported CPU core on JTAG chain" error. I even tried hitting the reset key, followed by holding On while shorting 1 and 6 on the serial port, in case it isn't always in SAM-BA mode when the flash is erased.

Does that error mean it sees nothing, or that it sees a CPU but not one that it supports?


#31

Hello,

Sam-BA works with the serial lines, so you will need to connect the serial port of your computer to a COM of your computer.
once done, start SAM-BA, tell it to connect to the appropriate COM and select the SAM7L128-EK (I beleive) as the target. then it should connect and you can do send/receive...

If you have properly erased the flash, you should have no issues using JTAG connector. but, what software are you running on the PC to connect? I am using the IAR tools...

it's easy to see if SAM-BA is running as it will chew your battery fast :-) so, never leave the battery in the calc if you have erased the flash...

cyrille


#32

Quote:
Sam-BA works with the serial lines, so you will need to connect the serial port of your computer to a COM of your computer.

SAM-BA gave me the choice of both the COM port and the AT91SAM-ICE on USB. I picked the latter, but once I solder a DE-9 connector onto the calculator, I will try the COM option instead.

Quote:
once done, start SAM-BA, tell it to connect to the appropriate COM and select the SAM7L128-EK (I beleive) as the target.

Yes, that is one of the choices (AT91SAML128-EK), and I tried selecting that before when I was using the SAM-ICE.

Quote:
but, what software are you running on the PC to connect? I am using the IAR tools...

I am using the Segger tools from their web site (J-Link ARM 3.90), since they made the SAM-ICE. By the way, that reminds me. In the Segger tools, although they are the latest version (dated yesterday) and the documentation says they are compatible with the AT91SAM7L series, there are no jflash files for the L series, just the other models. Maybe that's my first problem.

However, it still seems to use the Segger driver even when using the Atmel SAM-BA (from AT91-ISP 1.12). Is there an alternative driver for the SAM-ICE other than the Segger driver?

Quote:
it's easy to see if SAM-BA is running as it will chew your battery fast :-) so, never leave the battery in the calc if you have erased the flash...

I figured as much, and that's another reason why I plan to switch to AA power.

Thanks, Cyrille.

#33

Quote:
Sam-BA works with the serial lines, so you will need to connect the serial port of your computer to a COM of your computer.

I tried it with the COM port now, after soldering in a DE-9 connector. It still says "Fatal", "No valid processor ID found", same as if nothing were even connected. This is on a 32-bit Windows XP box (I haven't hooked up a serial port on my Vista x64 box yet).

I also triple-checked all my connections with continuity tests and they are all good.

My next step will be to desolder everything I added but the JTAG connector and see what happens. It shouldn't make any difference, because I don't think the serial port has any impact on the JTAG interface, and the calculator was running fine with the crystal so I don't think that's it either, but I'm running out of ideas. I probably will do that tomorrow; I feel like updating my web site now.


#34

Quote:
I tried it with the COM port now, after soldering in a DE-9 connector. It still says "Fatal", "No valid processor ID found", same as if nothing were even connected. This is on a 32-bit Windows XP box (I haven't hooked up a serial port on my Vista x64 box yet).

As a fallback (since SAMBA serial seems flaky to me), you might try Hyperterminal just to see if the UART and cable is working. Power cycle the cal and open a connection at 115.2k 8N1. Send the autobaud sequence manually until you get a ">" back from the calc. Then send a "V" followed by a "#" (2 chars) and it should reply with the version string (ascii text) of the onchip bootloader. (Mine replies with "v1.4 Nov 27 2007 17:52:23".)

The autobaud is two bytes, hex 0x80 followed by "#". I send it in Hyperterminal by holding down alt while typing 0128 (the leading zero matters!) on the numeric keypad. Then I release alt (sending the 0x80 char), then hit # (shift 3) normally. I usually have to do this twice before I get the ">" prompt.


Quote:
My next step will be to desolder everything I added but the JTAG connector and see what happens. It shouldn't make any difference, because I don't think the serial port has any impact on the JTAG interface, and the calculator was running fine with the crystal so I don't think that's it either, but I'm running out of ideas. I probably will do that tomorrow; I feel like updating my web site now.

I don't think the crystal could hurt, as the chip ignores it until software instructs the clock circuit to switch from internal RC to external clocking.


#35

Quote:
Send the autobaud sequence manually until you get a ">" back from the calc.

Unfortunately, once again I had no luck with this either. I must have sent the euro/greater-than sequence 100 times with no response at all.

I have now switched to powering it with two AA batteries because I probably wore the 2032s down a lot. The extra voltage (now seeing 3.0v) didn't fix anything either.

Since I've tried three different programs (IAR Workbench, Progger J-Flash, and Atmel SAM-BA) with no luck, I'm about out of ideas.

Quote:
I don't think the crystal could hurt, as the chip ignores it until software instructs the clock circuit to switch from internal RC to external clocking.

Today I desoldered everything I added, except the JTAG connector. Still no success whatsoever.

Thanks for your help, but I guess this calls for more drastic measures.

I have another 20b scheduled for arrival on Monday, so maybe I'll open it up and start over, hopefully with better luck. The calculator is cheap enough that it's not worth my time to keep debugging an unknown quantity. At least that will narrow it down to either the calculator or my software configuration. I guess it's always possible I fried the calculator without realizing it when I shorted the lines to erase the ROM.


#36

Quote:
I have another 20b scheduled for arrival on Monday, so maybe I'll open it up and start over, hopefully with better luck. The calculator is cheap enough that it's not worth my time to keep debugging an unknown quantity. At least that will narrow it down to either the calculator or my software configuration. I guess it's always possible I fried the calculator without realizing it when I shorted the lines to erase the ROM.

I'd be happy to troubleshoot your first one, if you feel like mailing it off.

#37

I don't think I'd add the EIA-232 level shifters, as then the calculator won't work with an official download cable, if such a thing every becomes available. Besides, a separate cable with a level shifter isn't hard to get. Mouser even stocks a suitable USB interface cable (but you're on your own for the connection at the calculator end).


#38

Quote:
Besides, a separate cable with a level shifter isn't hard to get.

This could work. But as you said, finding the right connector for the 20b end is the trick.

#39

Quote:
Did you hold down a key while attempting to establish the connection?

Initially, no, I did not. So I guess that may have been a factor. I've had a terrible time understanding the documentation, and it doesn't help that the search feature on this site is somewhat broken.

After I made my post last night I did some more experimentation. I then decided to try the "erase ROM" sequence (which I somehow misinterpreted in my tiredness to be the "reset into program mode" sequence). I pressed the reset button and then shorted pins 1 and 6 on the serial port while pressing On. This should have been obvious at the time, but then the calculator froze and won't do anything since, as I completely erased the ROM by doing this. Note for the future: don't do this.

So now I have no software on my 20b. My computer still won't connect to the 20b, even when I hold down On. It appears that whenever the batteries are in the calculator it is running at full power (I suppose that makes sense if the ROM is empty), so the On trick may not even be necessary now.

I tried another computer (Windows XP 32-bit), but it won't talk to the 20b with the AT91SAM-ICE either.

I know I have the JTAG connected right -- the JTAG cable has 20 pins, so I connect its first 16 pins to the 16-pin JTAG header. The jlink.exe tool properly reports VTarget as around 2.6 volts.

I don't have a scope -- any other ideas on how to debug this connection? Maybe I should just borrow a scope.

Thanks for the suggestions.


#40

Quote:
anything since, as I completely erased the ROM by doing this. Note for the future: don't do this.

It's not the end of the world.

Quote:
So now I have no software on my 20b. My computer still won't connect to the 20b, even when I hold down On. It appears that whenever the batteries are in the calculator it is running at full power (I suppose that makes sense if the ROM is empty), so the On trick may not even be necessary now.

It's actually running the SAM-BA bootloader, so yes, you should be able to connect your JTAG probe now. As far as I know, the bootloader never sleeps.

Quote:
I know I have the JTAG connected right -- the JTAG cable has 20 pins, so I connect its first 16 pins to the 16-pin JTAG header.

Yep, that's what I did as well. (Until I built my 20-16 pin cable.)

Quote:
I don't have a scope -- any other ideas on how to debug this connection? Maybe I should just borrow a scope.

I'd try the serial port with SAM-BA. I found it finicky, but it does work. You can program flash that way too. Be sure that your RS-232 transceiver is powered up--I'm not sure what the default state of the pin driving that transistor is.

Sorry, can't help with SAM-ICE or jlink...I'm using openocd and an old Luminary dev board as a JTAG probe.

#41

I just tried a similar thing on my 20B with the same results. Using IAR ARM Kickstart, I could read memory OK via JTAG, but once I download the HP example number-guessing code, my Segger J-Link refuses to talk to the processor. I got as far as erasing the flash, but now it just reports "Could not find supported CPU core on JTAG chain".

I've got a lot of experience with SAM7S processors and J-Link and IAR and I've never seen this on a SAM7S. Could this be related to the funky SAM7 reset line where you have to execute code to enable the reset input?


#42

hello,

Quote:
I just tried a similar thing on my 20B with the same results. Using IAR ARM Kickstart, I could read memory OK via JTAG, but once I download the HP example number-guessing code, my Segger J-Link refuses to talk to the processor. I got as far as erasing the flash, but now it just reports "Could not find supported CPU core on JTAG chain".

your problem is that the CPU needs to be turned ON for JTAG to connect...
and it's NOT... as soon as you release all keys, the CPU goes OFF.

so, the tricks is to press and HOLD a key and then only start the debug/download process while still holding a key as during that time the CPU will stay ON (in Idle Mode mostly).

regards, cyrille


#43

Quote:
your problem is that the CPU needs to be turned ON for JTAG to connect... and it's NOT... as soon as you release all keys, the CPU goes OFF.

Actually, it turns out that my problem was that I had no code in flash anymore and the processor defaults to powering up in the off state. The FWUP line needs to be asserted in this case (On button). After doing that, it stays on without pressing and holding a key.

Now my problem is that the IAR flashloader does not seem to write to flash via the J-Link. I can read and write registers and RAM via the JMem utility, but the flash is unchanged when I try downloading the sample project in the HP SDK. The flash loader also complains about the chip ID (0x27330740 vs 0x27330745 on my 20B) so maybe that is part of the problem.

Edited: 30 Aug 2008, 2:29 p.m.


#44

hello,


Quote:
Actually, it turns out that my problem was that I had no code in flash anymore and the processor defaults to powering up in the off state. The FWUP line needs to be asserted in this case (On button). After doing that, it stays on without pressing and holding a key.

In this case, SAM-BA is actually running (the Atmel boot loader) and is efectively running continously. when you erase the flash, be carefull to do a reset (which will turn the CPU off until you wake it up) or else you will drain your battery.

Quote:
Now my problem is that the IAR flashloader does not seem to write to flash via the J-Link. I can read and write registers and RAM via the JMem utility, but the flash is unchanged when I try downloading the sample project in the HP SDK. The flash loader also complains about the chip ID (0x27330740 vs 0x27330745 on my 20B) so maybe that is part of the problem.

do you have the latest version of IAR? or a version that you had from before. IAR only recently added support for L128 in their tool.

cyrille


#45

I am using IAR 5.20 Kickstart (current version).

Here's something else that's a bit odd: The sample project in the HP SDK fails to load into flash, but the sample SAM7L project (basic-slcd-stk-project) will load into flash OK. The LCD segments are not correct, but I can load and step through the code, something I could not do using the HP SDK project. I haven't yet figured out what the difference is.


#46

hello,


Quote:
I am using IAR 5.20 Kickstart (current version).

Here's something else that's a bit odd: The sample project in the HP SDK fails to load into flash, but the sample SAM7L project (basic-slcd-stk-project) will load into flash OK. The LCD segments are not correct, but I can load and step through the code, something I could not do using the HP SDK project. I haven't yet figured out what the difference is.


can you check in the project options, debuger, download if it's in 'download' more or in 'attach to program mode'?

regards, cyrille

#47

Quote:
Could not find supported CPU core on JTAG chain
Bad JTAG communication: Write to IR: Expected 0x1, got 0x7
(TAP Command : 2) @ Off 0x5.
Failed to connect

Any idea what that means? I am running the following software:


One thought--maybe your JTAG probe is clocking too fast. Try slowing it way down.

#48

Quote:
One thought--maybe your JTAG probe is clocking too fast. Try slowing it way down.

It's running at 5 kHz, the slowest it goes, so I hope not. I also tried 300 kHz and several faster speeds with the same results.


#49

Quote:
It's running at 5 kHz, the slowest it goes, so I hope not. I also tried 300 kHz and several faster speeds with the same results.

Hmm. I think the rule of thumb for non-adaptive (not using RTCK) setups is max JTAG clock rate of 1/6 the CPU clock, so you should be fine even at 300 kHz. (I'm pretty sure SAM-BA runs at 2MHz until it autobauds.)

Do you have an AT91 dev board or something else to test the JTAG hardware against?


#50

Unfortunately I have nothing else to test the JTAG against. I don't have much experience with this kind of thing; the only other even remotely related thing that I have is a fake STK500 (made by a friend) for programming the ATtiny chips for my serial cable.

I will probably next try your suggestion of using the serial port instead of the JTAG interface, just to give another option (though I definitely want the JTAG interface working). Unfortunately, I do not have the right connector (much less an HP serial cable), so I will have to solder directly onto the 6 pin port. But this means I won't be able to close the case, and therefore won't be able to install the batteries, so I will need to switch to external power.

I guess a Fry's trip is in order to pick up a twin AA battery pack. But first I have to get some real work done. :(

Thanks for your help so far.


#51

Quote:
I will probably next try your suggestion of using the serial port instead of the JTAG interface, just to give another option (though I definitely want the JTAG interface working). Unfortunately, I do not have the right connector (much less an HP serial cable), so I will have to solder directly onto the 6 pin port. But this means I won't be able to close the case, and therefore won't be able to install the batteries, so I will need to switch to external power.


You could tack some thin wires on the (now-empty) 0 ohm jumper pads and bring them (along with a ground) out through the hole you made for the JTAG connector. That will let you keep the pads clean for your eventual HP cable, yet still be able to close the case.


Possibly Related Threads…
Thread Author Replies Views Last Post
  HP's thinking behind the 20b/30b? John Ioannidis 3 1,760 09-07-2013, 10:21 AM
Last Post: Tim Wessman
  20b, 30b not in HP's web store Eric Smith 3 1,571 02-08-2013, 11:52 AM
Last Post: Walter B
  Very fast modified TEA for HP 48 and up! Raymond Del Tondo 0 931 11-23-2012, 08:43 PM
Last Post: Raymond Del Tondo
  A non 20b/30b 34S Matt Agajanian 22 5,291 08-20-2012, 01:06 AM
Last Post: Reth
  HP48SX seems fully functional won't run SELF TESTS? Bruce Larrabee 5 2,107 07-16-2012, 11:04 PM
Last Post: Luiz C. Vieira (Brazil)
  HP71 Modified John W Kercheval 0 948 05-19-2012, 06:01 PM
Last Post: John W Kercheval
  [WP-34s] IR conversion of 20b Alexander Oestert 3 1,580 05-18-2012, 05:38 PM
Last Post: Harald
  Fully testing HP 41 Le Babou 7 2,181 10-23-2011, 08:59 AM
Last Post: Allen
  Why hp-20b more expensive than 30b? Masaki Adachi 9 3,029 10-14-2011, 12:08 PM
Last Post: megarat
  missing segments on 20b running 34s db (martinez, ca.) 4 1,706 10-05-2011, 01:27 AM
Last Post: Walter B

Forum Jump: