We began by testing that the voltage levels on the board were correct. This is important, because the MEGAphone is designed to run on battery, and thus has step-up/step-down regulators to provide the various power supplies.
I say the various power supplies, because the MEGA65 has six switchable power supplies, so that you can selectively power down sub-systems based on the security level of what you are doing. For example, you can power down the bluetooth and wifi, so that nothing can attack you that way. Similarly, you can power down the microphones, so that there is no way at all of someone listening in on you from afar. The cellular modems and LoRa radios can also be separately powered down.
So, anyway, this means we have 7 voltage regulators in total, as the FPGA also has its own power supply, but no switch to control it -- that is instead done via soft control from the FPGA, via a power control line.
In our initial testing, we found that the rail for the FPGA board was 6.45V instead of 3.3V. Fortunately I had the presence of mind to not plug it in first time. We eventually tracked the problem down to a resistor that had come loose during the hand-soldering process. This won't be an issue in production, because all assembly will be fully automated.
In the process of trying to fix it, I did accidentally lift one of the pads of the resistor from the board. Needless to say, I wasn't real pleased. I was able to bodge it up with a couple of fly wires, and some lovely full-size resistors to create the correct overall resistance, as we didn't have the exact value resistor on hand. Bodge is indeed the correct word here. I meant to add a photo, but forgot to upload it.
With that solved, it was time to make sure we can program the FPGA board. This took a little fiddling, as I was trying it not-plugged-into the MEGAphone board, and it turns out you have to set a dip-switch setting for the little programming board to get power from the USB port. With that figured out, I was able to fairly quickly get a working blinking-LED bitstream running.
Then from there, reset the dipswitch, it was time to insert into the MEGAphone board, and program the FPGA. Success first time: blinking LED on the FPGA board.
Ok. So, from here it gets a bit more interesting, as we need to map the FPGA pins to the TE0725 FPGA module pins, and from there to the MEGAphone schematic. The TE0725 is designed to be rotateable, in that the connectors are symmetric, allowing us to slecxt the preferred orientation of the board. I have opted to have it oriented so that the programming cable can stick out the side.
Now for a little detective work to match up the pin numbers. This would be a whole lot easier, if we had a directly connected LED on the MEGAphone board, but we don't.
We do have some fairly easily probable lines to the WiFi adapter, though. So that might be the best way to work out which end of the connectors is pin 1, and match everything through. Once we have the pin order more or less under control, I can try synthesising the entire MEGA65 design, with the VGA output enabled. That will be a happy moment, to see the MEGA65 boot screen.
So the WiFi UART lines are on connector B pins 44 and 48, according to the MEGAphone PCB schematic. According to the TE0725 schematic, this should be FPGA pins L1 and L4, assuming the orientations are around the right way. So let's try to make them toggle between high and low. To tell them apart, I will make them toggle at different rates: 0.5Hz for L1 = WIFIRX, and 2.5Hz for L4 = WIFITX.
Fortunately synthesising such a simple design doesn't take too long, but it does still somewhat inexplicably take around 5 minutes. It feels like I could build the circuit by hand faster!
Ok. Bitstream synthesised. Now we have the extra fun that the power control circuitry on the MEGAphone has to be reckoned with: There is a line connected to the FPGA board that allows the power rail to the FPGA to be shutdown. To turn it on, you have to press the power button, or wait for an interrupt from one of the support chips. Of course, the power on button is on the front of the board, which is on the back from the perspective of how I have it sitting on the desk.
In trying to flip the board over to get to the button pads, I discovered that the power supply GND line had come loose. Fixed that, and I had power again. Excellent!
While waiting for synthesis, one other annoying thing I have at the moment, is that the fpgajtag program I use for conveniently programming the FPGA from the command line doesn't seem to work with this particular FPGA JTAG adapter. Oddly, the one I have at home does work in this mode. I don't really have any idea why as yet.
Okay, the new bitstream is finally running, and after fighting with a bad ground on the oscilloscope probe, I can find the signal on pin 48, but on the opposite side and end as expected - so our coordinates are rotated. No problem, find the pins from the schematic, and try again.
So pin 48, which is one in from the end should become pin 3, so that it is on the opposite side, one pin from the end. Pin 44 should then become pin 7. And of course, we have to switch between the two connectors. So WIFIRX should be L15, and WIFITX should be L23. But now that we know where L1 and L4 are, we can check continuity on the connector to the WIFI port, and work out that it should actually be pins 4 and 8 instead of 3 and 7 to be on the correct side.
Ok. Now another bit of fun, is that the labels for the header pins on the TE0725 FPGA board aren't actually FPGA pins. So a bit of searching and hair-pulling was required. Actually, quite a bit of both. But in the end I made a chart that lists the pin assignments:
Then it was time to help some students in another lab, but as luck would have it, there were only a few, so I had some more time to work on this. So everything went on the trolley, and came down with me. This is not exactly the intention of a portable MEGA65 to require a trolley, however ;)
But as you can see, I managed to get the VGA output, and also the UART monitor interface correctly connected. However, the SD card doesn't yet work, so booting to BASIC requires the use of the monitor_load utility to load everything. We can see in the shot below that the hypervisor is not having much luck finding an SD card:
This monitor also wasn't that thrilled about the HSYNC timing, which I will deal with later. Here is another shot of the screen after booting to BASIC: