pic12f629 CIC pin swap?

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
pic12f629 CIC pin swap?
by on (#141012)
Currently, the 12F629 PIC is used as a CIC replacement.
On the PIC IC, pins 2,5,6,7 are used as I/O's.
Is there a way that the pins can be reconfigured so that data from pin2 of the PIC is changed to pin 4?
I ask this because if that pin change is able to take place, I can program/reprogram it in circuit through the cart edge connector. I shouldn't even have to open the case (in theory anyways) to program it.
The programming pins are 4,6 and 7. 4 is unused currently in CIC usage.

So if this is possible, could I trouble someone to help me with this?

Thanks
Re: pic12f629 CIC pin swap?
by on (#141013)
I'd assume if you have the source files for the superCIC that you could just switch the code around to swap the pins, and then recompile it. Unless those pins aren't I/O pins, then i'd say no.
Re: pic12f629 CIC pin swap?
by on (#141014)
12f629:
Code:
                 VDD    1               8   VSS
 GP5/T1CKI/OSC1/CLKIN   2               7   GP0/CIN+/ICSPDAT
GP4/T1G/OSC2/CLKOUT     3               6   GP1/CIN-/ICSPCLK
        GP3/MCLR/VPP    4               5   GP2/T0CKI/INT/COUT
Pin 2 is fixed function here, it's the master clock input for the microcontroller. It's remotely plausible (if /MCLR is disabled) that you might be able to permanently connect pins 2 and 4 together, though. Of course ... then you can't use high-voltage programming without damaging the PIC by exposing pin 2 to high voltage :/

You could disable /MCLR and add a 12V-tolerant inverter or buffer from pin 4 to pin 2. That should get you both worlds...
Re: pic12f629 CIC pin swap?
by on (#141015)
So the master clock can't be on pin 4? In the SuperCIC, pin 4 is used as a "/pairing" mode.... which I'm not using. I'd prefer not to damage the device in programming (unless a diode could be used to protect pin 2 maybe?).

Edit: how would I disable the MCLR?

Edit2: I'm just needing a pathway to the PIC's pin 4. Could I use the IRQ pathway on the cart edge? all standard carts don't have that pin connected to anything. Of course, if I did make the IRQ pin connect to the PIC pin4, would that mess-up the console or just ignored by both console and PIC?
Re: pic12f629 CIC pin swap?
by on (#141017)
No, master clock input is always pin 2, always. The other three are controlled by software, but...

As to whether /MCLR resets the PIC or instead is usable as a general-purpose input, that's controlled by the PIC's configuration flags:
Code:
REGISTER 9-1:    CONFIG — CONFIGURATION WORD (ADDRESS: 2007h)
 R/P-1 R/P-1 U-0   U-0  U-0  R/P-1 R/P-1  R/P-1 R/P-1 R/P-1 R/P-1 R/P-1 R/P-1 R/P-1
 BG1   BG0    —    —     —   CPD    CP   BODEN MCLRE PWRTE WDTE F0SC2 F0SC1 F0SC0
bit 13                                                                          bit 0


Since the pin is already used as a "/PAIRING" input, /MCLR is probably already disabled; the only question is whether the program would be confused by having that pin toggle continuously.

I guess it's possible you might be able to use a resistor to protect CLKIN while /MCLR is at +12V. The '629 is rated to a maximum of 20mA of clamp current, so any resistor strictly greater than (12V-5V)÷(20mA)=350Ω should keep it from dying. (I'd go up by an order of magnitude for safety's sake). The only question is whether the ≈4MHz clock source from the SNES can pass through that resistor.


All this said, it looks like it might be possible to port the supercic to the 10f322, which is a 6-pin part, and all four non-power pins from the PIC would necessarily then be brought to the cartridge edge.
Re: pic12f629 CIC pin swap?
by on (#141018)
lidnariq wrote:
No, master clock input is always pin 2, always. The other three are controlled by software, but...

As to whether /MCLR resets the PIC or instead is usable as a general-purpose input, that's controlled by the PIC's configuration flags:
Code:
REGISTER 9-1:    CONFIG — CONFIGURATION WORD (ADDRESS: 2007h)
 R/P-1 R/P-1 U-0   U-0  U-0  R/P-1 R/P-1  R/P-1 R/P-1 R/P-1 R/P-1 R/P-1 R/P-1 R/P-1
 BG1   BG0    —    —     —   CPD    CP   BODEN MCLRE PWRTE WDTE F0SC2 F0SC1 F0SC0
bit 13                                                                          bit 0


Since the pin is already used as a "/PAIRING" input, /MCLR is probably already disabled; the only question is whether the program would be confused by having that pin toggle continuously.

I guess it's possible you might be able to use a resistor to protect CLKIN while /MCLR is at +12V. The '629 is rated to a maximum of 20mA of clamp current, so any resistor strictly greater than (12V-5V)÷(20mA)=350Ω should keep it from dying. (I'd go up by an order of magnitude for safety's sake). The only question is whether the ≈4MHz clock source from the SNES can pass through that resistor.


All this said, it looks like it might be possible to port the supercic to the 10f322, which is a 6-pin part, and all four non-power pins from the PIC would necessarily then be brought to the cartridge edge.


the 10F322 sounds like a better plan. This is for future designs as my current stuff is already set in stone (so to speak). Would porting it just require renaming the GIO pin names to match the new PIC's pins?
Re: pic12f629 CIC pin swap?
by on (#141021)
Maybe? The SuperCIC is just a tiny bit too big (522 words) for the 10f322 (512 words), but removing pair mode (8 words) gets most of the way there...

The source also doesn't use any processor directives to allow remapping of I/O, so it'll be a bit of a tedious careful replacement thing.
Re: pic12f629 CIC pin swap?
by on (#141022)
Couldn't you run one pin out to the expansion port or something?
Re: pic12f629 CIC pin swap?
by on (#141023)
tepples wrote:
Couldn't you run one pin out to the expansion port or something?


All I'm needing is a pathway from any of the pins. My carts don't use the expansion pins but I don't know how the activity of those pins would affect the CIC (or the console) if I leave it connected to the PIC
Re: pic12f629 CIC pin swap?
by on (#141025)
tepples wrote:
Couldn't you run one pin out to the expansion port or something?
SNES, not NES.

I guess there's the single EXPAND pin.
Re: pic12f629 CIC pin swap?
by on (#141026)
lidnariq wrote:
tepples wrote:
Couldn't you run one pin out to the expansion port or something?
SNES, not NES.

I guess there's the single EXPAND pin.


my carts only use the main buss connector. they don't have the expansion pins....(I wasn't thinking about that a moment ago) so the expansion stuff isn't a possibility (unless IRQ can be used). Could the reset line be attached to PIC pin 4 as a pathway? It's pretty static during console operation.
Re: pic12f629 CIC pin swap?
by on (#141027)
Does SNES /RESET go anywhere else? (e.g. to a MAD-1 or a battery controller?) If not, that should work fine.

You could connect any pin on the cartridge edge that's not used by the cartridge to the SuperCIC /MCLR input; disabling the /PAIRING input is a simpler task than moving all the pins to work on the 10f322.
Re: pic12f629 CIC pin swap?
by on (#141029)
lidnariq wrote:
Does SNES /RESET go anywhere else? (e.g. to a MAD-1 or a battery controller?)

You could connect any pin on the cartridge edge that's not used by the cartridge to the SuperCIC /MCLR input; disabling the /PAIRING input is a simpler task than moving all the pins to work on the 10f322.



/RESET goes to the SRAM CE2. I don't see it going anywhere else.
So maybe the best plan is to disable the software /PAIRING and run the rest line to CIC pin 4.
Then on my programming connector, do the same connection - but if the PIC programmer uses 12volts, that'd be pretty bad for my SRAM IC......
Re: pic12f629 CIC pin swap?
by on (#141031)
lidnariq wrote:
Does SNES /RESET go anywhere else? (e.g. to a MAD-1 or a battery controller?) If not, that should work fine.

You could connect any pin on the cartridge edge that's not used by the cartridge to the SuperCIC /MCLR input; disabling the /PAIRING input is a simpler task than moving all the pins to work on the 10f322.



Lidnariq, I sent you a PM...

Simple or not, It seems if it can be ported to the 10F322, that may be the best long term, straight forward plug and play solution.