Good news everyone, the circuit is finished 😀 !

Well, not so fast! Now everything is connected, but there are some last minute modifications to the circuit that were introduced just now. I will work on those first thing next week, and hopefully, I will start with the PCB layout. Here are the updates for the last week.

First, here is the visual diff of the root sheet.

root_diff

Edit from last week: Cyan is Additions, and red are Deletions.

In-Circuit Serial Programming

Oh, ICSP! It took us MUCH more time than I expected to finally reach a solution! And unfortunately, that solution couldn’t be implemented after all. Here’s the full story. I hope someone one day will find this helpful, and hopefully, it’ll spare him the troubles of pursuing this path.

4-Pin ICSP Connections

Our “ideal” target was to incorporate the ICSP connections within the Ethernet jack, hence, utilizing the 4 non-connected pins of the jack, as well as easing the process of programming the PIC micrcocontroller. The most obvious problem, is that ICSP needs 5 pins, whereas only 4 pins are available in the Ethernet jack. I had to dig in the ICSP specification for PIC18F97J60 family and PICkit 3 user manual as well, to figure out a way around that.

ICSP pins are MCLR, PGC, PGD, Vdd and Vss. For programming PIC18F97J60 family, all these pins have to be connected. However, it is not necessary that Vdd and Vss come from the programmer. In fact, it is preferred that the circuit is powered externally. The other three pins have to be connected directly to the programmer, however.

So, why not get rid of these power connections? The answer for this question is in the PICkit 3 user manual. There are many programmers out there, but we decided to design our circuit for Microchip PICkit 3. If you are not using this programmer, check your programmer’s documentations. PICkit 3 can act as a programmer or as a debugger. When it is used as a debugger, it provides many features such as setting breakpoints, see registers, etc. As a programmer it will only program the microcontroller without allowing such features. From its user’s guide, when it’s used as a debugger, Vdd is required to be connected, even if the the circuit is powered externally. The user’s guide states “If the debugger does not sense voltage on its V DD line (pin 2 of the interface connector), it will not operate.” However, it is a different story when it’s used for programming only, i.e. as programmer not debugger. Ground should be connected to the circuit ground, but Vdd is not required as it is not used to sense voltage, hence, eliminating the need for it.

If we are using ICSP for programming only, then we can connect only 4 pins. And with this setup, the first problem was solved.

The Ethernet jack

Now, that’s settled, it is time to choose a suitable jack for the Ethernet. What you need to know is that we are using Ethernet to interface with the PIC18, with 2 differential pairs, i.e. 4 pins. It is better, and cheaper for us to use a jack that has internal transformers, so we don’t need to connect external ones, adding cost and taking PCB land. The problem that we’ve overlooked, is that there are no jacks that have 4 pins connected to transformers, and the rest are connected directly to the circuit! ICSP of course needs direct connections. And anyway, the cost of such jack is more than the one we are using now, with only 2 differential pairs.

So, although we can connect ICSP with only 4 pins, there are no practical jacks we can use! Again, we are back to square one. At least, now we know that we cannot use this option. Now we are connecting the ICSP as a dedicated port in the PCB (the new cyan port at the bottom of the visual diff above).

USB Data Lines

The main use for the USB port in the circuit is to power the board. Data lines were not connected in the previous design. However, if we can interface the PIC18 with the USB lines, it can let us add more features to the board. The PIC18 we are using doesn’t have a hardware support for USB, hence, we need a software solution. There is this project, 16FUSB, which implements a low-speed USB in PIC16F628/628A microcontroller. Since our PIC18 is similar, it may be possible to modify this project slightly and use it for our board. My task, however, is limited to connecting the circuitry. I followed the project circuit as a guide, but modified it a bit. Here is the Power sheet of our circuit. The USB connections are the new ones, in cyan.

power_diff

The16FUSB circuit can be found on page 5 of the project document. For the data lines connections, I basically connected them the same. D+ line is connected to interrupt 0, and D- to interrupt 1 through 100 ohm limiting resistors. Both lines are connected to interrupt 2 through diodes and a Pull down resistor. A pull up resistor is added to line D- to indicate that it is connected in low-speed mode, and to start the device recognition by the host. One difference in the circuit is that I removed the two Zener diodes, as PIC16F628/628A operates on 5V, and these diodes are needed to limit the voltage to 3.3 volts for the data lines. Since our PIC18 operates on 3.3V, these diodes are not needed. Other than that, the circuit is basically the same.

Additional changes

The list of minor changes this week includes:

  • Removing the SD card connections to the FPGA: Previously, the microSD card was connected to both the FPGA, and PIC18. We changed that now so it is only connected to the PIC18 microcontroller. This will most likely change next week. I will keep you updated.
  • Adding power flags to the circuit: This is only needed for the electric rule check of Eeschema. Nothing important.
  • Removing Timer1 oscillator: This will add cost (both in money and PCB area) than it adds features! Now it is gone!
  • Adding a heartbeat LED to the microcontroller.
  • Connecting the rest of PIC18 pins to the FPGA: In the future if we wanted to add some features of the PIC18, at least the connections are there.

Well, that’s it for this week. Next week I’ll do some changes to the circuit (to the microSD card specifically), and you might finally see some work on the PCB layout. So keep an eye for that.
Talk to you next time..


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.