Jaffe- / NESizer2

A synthesizer based on the 2A03 (NES APU)
107 stars 19 forks source link

Build Problems #13

Open circuitcreature opened 1 year ago

circuitcreature commented 1 year ago

I have the synth all built and as mentioned in another issue I used the MXD1210CPA+ instead of the DS1210. I am able to flash the Atmega using an Arduino and set the fuses to E:FF, H:DF, L:E0, or E:FF, H:D9, L:E0.

The issue is when I power it up all the LEDs light up and it doesn't produce any sounds. I have also tried the init within the settings using buttons 8,9,11, and 14, but nothing appears to happen after pressing 11 and 14. Pressing 8 then 9 does cause the LEDs to brighten and a sequence starts on the screen for about a second.

I can however test the chip type correctly with a returned value of 12.

Once after powering on it did start making sounds, but I haven't been able to reproduce that.

Any troubleshooting ideas?

Jaffe- commented 1 year ago

It is normal for it to behave strangely at first bootup, because the RAM just contains junk. The RAM is initialized properly when going to the settings mode and using 8, 9 and 11. Next boot after this it should work more as expected. This is one of the less finished parts of the SW, it should really just auto detect corrupt memory and initialize automatically.

If it it does not help to press, 8, 9 and 11 (when in settings mode) and power cycling, then I suspect that something might be wrong with the SRAM memories or surrounding circuitry. I would check the RAM chips (IC10, IC11) and the address latches (IC7, IC8, IC9) and the address decoder IC5 for any soldering issues. Same for the battery backup circuitry (DS1210). And of course, just to double check, you do have a battery installed?

circuitcreature commented 1 year ago

I put the battery in and tried the init and power cycling and everything is working. I still have the issue with the LEDs always being lit, but I can live with that. I'll have to check my BOM, but I ended up using a different LED from the committed BOM, so there might be something in there. Great project thank you.

Jaffe- commented 1 year ago

That sounds strange. Are they always on, but brighter when actually supposed to be lit? Otherwise it sounds like it would be hard to use ...

I pushed some new code now, it checks whether the RAM has become corrupted. If it is, 'cr' will flash in the display at boot and the RAM will be properly initialized (same as manually performing it in the settings menu).

circuitcreature commented 1 year ago

Correct, they are alwasy on and sometimes get brighter, this is only noticeable when the init runs after pressing 8 => 9, but other than that there is no indication when on a specific mode. I used mouser #696-SSL-LX3054IID, but they look to be mostly the same as the OG BOM.

Thank you for the code update. I'll give that a try next time I get the flasher setup.

Jaffe- commented 1 year ago

Sounds like something might be wrong on the panel board. I would check the row and column latches there. Do all the LEDs do this, or just some of them? What about the 7 segment display? The LEDs are very similar to the ones in the BOM, so I don't think they are the issue here.

circuitcreature commented 1 year ago

Double checked everything and it looks fine. It only happens to the LEDs, the display displays 00 when nothing has been selected. As for the update, I get a battery warning and cr on every boot and it wipes all previous settings, like midi channels.

beau-seidon commented 1 year ago

There are a few items in the committed BOM which are obsolete. I had to select suitable replacements. Also @Jaffe- did mention, in a reply to one of my Issues, that the BOM is not as up-to-date as the schematic. One example I found is that the part number listed in the BOM for the bus resistor on the top board is for a 4.7k instead of the 15k from the schematic.

When I built mine, I opened the .sch file in Eagle (free version) and exported a new parts list, then carefully compared the committed BOM to the new list. I used both as a reference to build my own cart on Mouser, defaulting to the schematic when I found conflicts.

I have attached an export of my Mouser cart with all the parts I used in my build, for your reference. Mine is working great without any electronics issues.

exported_mousercart(nesizer_only).xls

circuitcreature commented 1 year ago

Thank you @beau-seidon I'll compare yours to mine and update as needed. I'll report back if I order any new parts. edit: Ordered more parts, the resistor array, clock, and diodes.

Jaffe- commented 1 year ago

Double checked everything and it looks fine. It only happens to the LEDs, the display displays 00 when nothing has been selected. As for the update, I get a battery warning and cr on every boot and it wipes all previous settings, like midi channels.

Does not sound good! I think the cr error should only occur once the first time (and yes, the settings will be erased too. I should have warned about this...) After it has written the expected signature to RAM, it should work fine after the next boot. If it does not, it means that the battery backup is not working and has corrupted the RAM.

I will check whether the battery fault is now always showing with a fresh battery also. It might need some more work to be reliable.

beau-seidon commented 1 year ago

Thank you @beau-seidon I'll compare yours to mine and update as needed. I'll report back if I order any new parts. edit: Ordered more parts, the resistor array, clock, and diodes.

If you are talking about the switching diodes, you can use the ones in the BOM (1N4148 are equivalent to the 1N914 diodes that I bought, and there will be no functional difference).

The clock will make an enormous difference if you got the wrong one. Particularly if it oscillates at a different frequency than the design. If the freq. is wrong though I wouldn't expect it to boot at all.

Not sure what effect the resistor array difference would make, other than potentially passing too much current through the buttons if several are pressed at once? Full disclosure: I bought the wrong one too and almost said screw it I'll install it anyway lol. In the end I decided not to and got a 15k replacement before turning it on.

I'm not implying anything here, but triple check that all your IC's are oriented correctly. I booted it up the first time with my 2A03 in backwards because I am stupid, but it didn't hurt anything as far as I can tell. It still goes beep boop.

circuitcreature commented 1 year ago

ICs look good. I also picked up more latches, to test out. I might have messed something up on first boot, i had the pins off by one with the mainboard and panel. As far for the cystal it is 20mhz, worse case I'll build another one.

Jaffe- commented 1 year ago

@circuitcreature Let me know what you find out. If you know some programming, you could try to change the update speed of the LEDs in the code. See src/task/task.c line 84 which defines the update rate for the LED refresh. If you increase this period, it should update slower and perhaps make it easier to debug. You could also try and just locally mod the code to add a mechanism to single-step the LED rows and columns from one of the buttons.

Regarding the battery level and corrupt RAM warnings, it just dawned on me that the board I currently have fully assembled is an older v0.5 board with some mods, so the battery related stuff is not the same as in the latest design. I should build a new main board based off the latest version before attempting to write any clever code, I think. I will revert the change related to battery low and memory corruption errors until I can test it on a new board.

Just out of curiosity, what do you see when you press the battery level indicator in settings? (press and hold second rightmost button on first row) Same for you as well, @beau-seidon, what does the battery level indicator show in your case?

circuitcreature commented 1 year ago

@Jaffe- I've been digging around in the code, it's been a while with C. I'll look at the refresh rate. As for the battery it displays 45. I'm pretty sure this one is new, I can dig around and see if I have another to test.

beau-seidon commented 1 year ago

Just out of curiosity, what do you see when you press the battery level indicator in settings? (press and hold second rightmost button on first row) Same for you as well, @beau-seidon, what does the battery level indicator show in your case?

I haven't updated my NESizer with the most recent code you pushed. It is running a hex with my NoteOn&Vel=0 changes, and a hack to mute the output at boot, but no other mods.

When I check battery voltage by selecting Settings mode, and holding Button 7, I get 4.3 on my segment LED. I can update the firmware with your most recent code and check again if you'd like.

20230902_155035

beau-seidon commented 1 year ago

Regarding the battery level and corrupt RAM warnings, it just dawned on me that the board I currently have fully assembled is an older v0.5 board with some mods, so the battery related stuff is not the same as in the latest design. I should build a new main board based off the latest version before attempting to write any clever code, I think. I will revert the change related to battery low and memory corruption errors until I can test it on a new board.

@Jaffe- I have 4 more pairs of the latest PCBs in red+blue. You want one?

circuitcreature commented 1 year ago

I changed the speed on the LEDS and all they do is pulse slower, but still remain on. I've swapped out the latches on the panel board and no change with the LEDs. I also swapped the latch and the ICs next to the atmega chip and no change. Out of curiosity I removed an LED and swapped its polarity and it remained on.

IMG_7073 The 7 segment looks blown out in the picture, but it displays fine.

beau-seidon commented 1 year ago

How did you orient your LEDs?

When I built mine it wasn't exactly clear without following the traces on the PCB, which was doable, but I found that the cathode/anvil for all LEDs should face the right side of the board. (In the photo below they point left because the board is rotated.) I would assume that if they were backward they would just be off all the time, but it is interesting that yours is on after reorienting.

@Jaffe- even if not the issue here, perhaps the silkscreen on the top board should be updated to show LED orientation in future versions to help prevent mistakes by new builders.

20230906_004148.jpg

circuitcreature commented 1 year ago

I am unable to see the cathode in the LED, in fact looks like the only way to tell is the flat part of the epoxy, which is on the right of the board.

IMG_7075

Jaffe- commented 1 year ago

That is right, the cathode is the flat part of the epoxy. Also before cutting the pins, the short one is the cathode on the LED.

The silkscreen is unfortunate as @beau-seidon pointed out. It is actually indicated on the silkscreen layer if you look at panelboard_pcb.png, on the right side the circle has a flat/straight edge. However, on the produced board (at least my ones) this is not possible to see because the holes cut through it. I agree this should be more clearly indicated!

The correct orientation is that the cathode should be on the right side when viewing the board the same way as in panelboard_pcb.png.

circuitcreature commented 1 year ago

I had some time to work on this and got it working. The original LEDs I had were the issue. After a long slow boat shipment, I replaced them with another brand and everything works great.

I also tested with a 2A03-G and a UA6527P, and both work great.

I've seen the recent commits and will try that version soon.

Thanks @Jaffe- and @beau-seidon !

IMG_7280-min

beau-seidon commented 1 year ago

Nice! I'm glad you got it working.

It's tied with the Twisted Electrons TherapSID for my favorite chip synth.

circuitcreature commented 8 months ago

@Jaffe- Not sure if you can help. I went to turn on the synth the other night and there was no sound or lights. I've checked the voltage across all the chips on the panel and several on the main board and most everything is showing 5v.

The odd thing is that avrdude programs the chip just fine.

Any advice on things to check?

Jaffe- commented 8 months ago

@circuitcreature: That is weird! Have you checked the clock and its power supply too? This might also be something that is failing during initialization. Everything will hang if the 2A03 is not working for instance. What kind of 2A03 do you have installed?

circuitcreature commented 8 months ago

Pin 1 on the clock is 2v and pin 2 is 2.5v I have tried both a RP2A03-G and UA6527P

When I plugged the arduino in the lights flashed for a second.

Jaffe- commented 7 months ago

@circuitcreature That is strange indeed. I'll try and see if I can decouple the 2A03 code a bit from the system so it can boot without it installed (probably a nice feature anyway, at least the NESizer can then be used as a MIDI sequencer :p)

In the mean time, can you try switching out the Atmega and see if that makes any difference? I did have an issue with an Atmega earlier that was somewhat like what you describe, but I thought it was just a bad chip because it worked fine when I switched it out...

Jaffe- commented 7 months ago

@circuitcreature I added support for running without 2A03 now. You can try building and installing that commit to see if the communication with 2A03 is the issue (although it seems unlikely as it fails with two different chips).

beau-seidon commented 7 months ago

Try re-burning the fuse bits. I just temporarily bricked my ATmega chip by accidentally pressing Ctrl+C in the terminal while it was flashing firmware. I couldn't get it to do anything or respond to another flash command, but found that re-burning the fuse bits reset it and it's working fine again.

circuitcreature commented 7 months ago

Thanks @beau-seidon. I've swapped chips and finally got something, even though I think I'm back to the original chip that first started with the issues. I have it setup for debugging and it's powering on, but not functional. It could be that it's connected with test wires. I'll try again when I have some more time. I also have some more atmegas in the mail, I'll be able to test with those if all fails.

beau-seidon commented 6 months ago

I just got a UA6527P from eBay to test it out and it doesn't seem to work at all in the NESizer. My 2A03G from my NES still works perfectly. Might just be a bad chip. No idea how to troubleshoot it.

Jaffe- commented 6 months ago

@beau-seidon: are you able to test the UA6527P in an NES? Like you say it might be a bad chip. There's a lot of fakes out there. I'm fairly certain that I tried a 6527P at some point, I can try and see if I still have it.

What do you see in the settings page if you press the 'CHIP TYPE' button (rightmost in the upper row)? If it says 0, then I would say that it is a high probability that the chip is not functioning correctly, because this means that it was not able to complete the 2A03 detection sequence (feeding it instructions and checking for R/W line transitions). edit: note that you need software built from one of the last three commits in master for the NESizer to be able to boot without a working 2A03. It was recently added with commit d2233d6fcc

beau-seidon commented 6 months ago

It did not work in my NES. I contacted the seller on eBay and he refunded me. I'd rather have a working chip than the money though, that's why I bought it lol.

I'll test it for fun using your function when I get home, just to see what it says.

circuitcreature commented 6 months ago

The 6527p does work. I have a couple more i can test when I'm back up and running. I'll have some atmega chips soon. @beau-seidon if this batch of 6527p works i can send you a link.

beau-seidon commented 6 months ago

What do you see in the settings page if you press the 'CHIP TYPE' button (rightmost in the upper row)? If it says 0, then I would say that it is a high probability that the chip is not functioning correctly, because this means that it was not able to complete the 2A03 detection sequence (feeding it instructions and checking for R/W line transitions).

Using the latest build, pressing the CHIP_TYPE button causes the 7 segment display to show [ - - ], when the button is held. With my 2A03 chip in, it shows [ 1 2 ], which I expected since I removed it from my NES. So yeah, the UMC chip is either dead, or fake.

beau-seidon commented 5 months ago

This is a reply to: https://github.com/Jaffe-/NESizer2/issues/10#issuecomment-2177410174

@jeff464 please describe how your unit is "misbehaving". No lights or flickering lights? No response to button input? Were you able to successfully set the fuse bits, and flash the firmware to the ATmega chip?

Which software are you loading to the NESizer? I recommend using the @Jaffe- master branch, until you are sure it's working, then play with experimental forks/branches.

If you have trouble compiling or uploading, try using VSCode+PlatformIO to build/load it. If you use the prebuilt .hex file, you can use avrdude (comes with ArduinoIDE) to flash it. For more info see this link, and check out the other Closed issues: https://github.com/Jaffe-/NESizer2/issues/24#issue-2302456124

Funny noises coming from output channels? I know the software has been updated a few times since I built mine, but this post might still be relevant, regarding first-time startup: https://github.com/Jaffe-/NESizer2/issues/7#issuecomment-926837146

Lights and input ok, but no sound at all? Make sure you have the voices you want to play enabled, and assigned to MIDI channels. Also make sure your audio cable is in the right jack and the switch is set properly if you are mixing to mono.

jeff464 commented 5 months ago

I turn on the unit and some lights flicker/character display barely flickers. Unit is unresponsive to any button pushes/no sound. All points checked out okay with the multimeter, Official .hex was used and wrote successfully/verified using GQ4x4 writer.

Other notes:

Command line anything isn't an option for a few more weeks - trying to maintain my sanity (build/troubleshooting now going on 90+ hours, timed) Not entirely sure how to program fuse bits using the GQ4x4. I assume this is the root of the problem.

jeff464 commented 5 months ago

Tried using avrdude since I'm a glutton for punishment - it opened and immediately closed despite running as administrator. Not ideal, so I found a GUI by the name of avrdudess. Cool.

I now have an arduino uno, atmega328p, and avrdudess. However, I cannot for the life of me find instructions on how to upload the hex + fuse settings to the 328p using just the uno. Surely this is possible?

beau-seidon commented 5 months ago

Oh yea. If you haven't set the fuse bits that's definitely the problem. The fuse settings tell the chip to use the external 20 MHz clock, and if it's still using internal 8 MHz it's probably just going to hang when interacting with the APU.

I have never used a GQ-4x4 or the related software, and can't find the programmer ID to use with avrdude, but their web site says it does support AVR ISP so there ought to be a way to set them. Found this post on their forum, maybe it's helpful? https://www.mcumall.com/forum/topic.asp?TOPIC_ID=6106

If you can't get the GQ-4x4 to work, and you do have an Arduino UNO, first plug it in with USB and open the ArudinoIDE and load the example sketch ArudioISP to your UNO. image

It will then be configured to behave like an STK500 AVR programmer. Now you can use it with avrdude or another application like AVR Studio to do whatever programmers do.

Note: avrdude is a command line application which will close as soon as it is done executing when launched from the GUI, and if you give it no arguments it finishes and closes right away. That may be what you are seeing. To keep it open you have to launch it from CLI.

Use this page as a reference for connecting your UNO to the NESizer's ISP pins. https://docs.arduino.cc/built-in-examples/arduino-isp/ArduinoISP/ Specifically this section:

image image

^ This is how I program my NESizer. I even made my own little custom connector out of m/f jumper wires and shrink wrap tubing. I DO NOT connect the 5V terminals between the UNO and the NESizer, just 10-13 + GND. Not sure it will hurt anything if you do, but I wouldn't.

After your UNO is configured and your connections are made, launch Windows command prompt and paste this command in to burn the fuse bits (replace COM4 with the COM port for your own UNO):

avrdude -C "C:\Program Files (x86)\Arduino\hardware\tools\avr\etc\avrdude.conf" -v -p atmega328p -c stk500v1 -P COM4 -b 19200 -U lfuse:w:0xe0:m -U hfuse:w:0xd9:m -U efuse:w:0xff:m

It will launch avrdude, tell the application where to find the config file, tell it to print out what it's doing, tell it what kind of chip it will be programming, what programmer it will be using, and which COM port, baud rate, and the fuse bit values to write.

You may have to re-load the .hex file to the board afterward. If so, you already know how to do that. If you want to upload it with avrdude using your UNO use this command (update the COM port and path to your .hex file before executing):

avrdude -C "C:\Program Files (x86)\Arduino\hardware\tools\avr\etc\avrdude.conf" -v -p atmega328p -c stk500v1 -P COM4 -b 19200 -U "flash:w:%USERPROFILE%\Desktop\nesizer_fw.hex:i"
jeff464 commented 5 months ago

Thank you for the detailed response - I sincerely appreciate it. I ended up flashing the Uno board, went out and bought another, came back, wired the two Arduino Uno boards together, and used AVRDUDESS to write the .hex w/ fuse/lock bits. Unfortunately, I am receiving the same exact behavior as before. I'm going to attempt to attack this from a few different angles over the next few hours.

beau-seidon commented 5 months ago

Are you programming the NESizer ATmega328p chip by installing it in an UNO/other external board?

Try putting it back in the NESizer and connecting the UNO configured as an ISP programmer directly to the header on the left side of the NESizer.

If you are programming it while loaded in an UNO board with the 16 MHz crystal, I'm not sure how it will behave if the fuse bits are set such that the chip expects a 20 MHz clock. This was my plan originally, but I never tried it, I just programmed it "In-System".

EDIT: just checked out avrdudess. Looks dope!

jeff464 commented 5 months ago

I connected the side ISP pins directly to the Uno and force flashed - avrdudess wasn't recognizing the 328. I'm getting a similar result with the LEDs/display, but at least now it's responsive to a degree. When I hit the settings button, the LED lights, so that's a good sign.

That said, I'm reading about the NESizer initialization button combination in order to clear the garbage data, but I'm confused. It says to press button 8, 9, 11, and 14 while in settings mode. Is this at the same time or in order? If in order, how long do I wait between button presses? Also, those button numbers don't align with the numbers on the PCB, so I'm not sure if it actually means 9, 10, 11, and 15.

jeff464 commented 5 months ago

This is what the display looks like when powered on. Almost like a "dd" 20240620_152014

beau-seidon commented 5 months ago

It's alive! (More alive than it was anyway :) ) The buttons are zero-indexed (first top left button is Button_0, second button is Button_1, and so on). Press them one at a time, in the order @Jaffe- stated in that post.
The PCB silkscreen is a little out of date, and apparently so is the Settings section of the manual. This is from ui/ui_settings.c image image

The first few go quick, but the last one takes forever because it formats the big memory chips. Give it about 5 minutes of SAMPLE_FORMAT then reboot it, and it should work!

jeff464 commented 5 months ago

Hmmmm, I think something is up. I go to settings, hit 8, and then the four of the bottom LEDs flash rapidly. I assume this is supposed to happen, but nothing changes after about ten minutes lol. 9 seems to do something - the character display rotates briefly. 11 does nothing, and 14 also seemingly does nothing after several minutes.

If I plug in the audio cables and crank the volume, I can hear a quiet whine and tapping.

beau-seidon commented 5 months ago

If you reboot does it work now? Does the 7seg display 00 and change with the Up and Down buttons? If so push one of the voice buttons (0 - 5). Does the corresponding LED stay lit? If so, go to Settings mode then hold MIDI Channel then select one of the voices and choose a channel, then feed it notes.

jeff464 commented 5 months ago

It does not work after resetting, and the display does not change. Pressing channel 1 lights LED 1, 3, and 8. Pressing channel 2 lights LED 1, 2, 3, and 8. Pressing channel 3 lights LED 1,3, and 8. Pressing channel 4 lights LED 1, 2, 3, and 8. Pressing channel 5 lights LED 1,3,5, and 8. They do stay on once pressed. If I choose a a MIDI channel, LEDs flash, but I have to reset the unit for it to stop flashing. There's no audio, and I still hear clicking/whining.

beau-seidon commented 5 months ago

I see you have the top and bottom boards connected via jumper wires. I wonder if there's a bad connection there. Also when you flashed the .hex using your UNO, did you first set the fuses with the chip in the NESizer? ( Low = E0, High = D9, Extended = FF )

jeff464 commented 5 months ago

I now cannot get any software to read (or write without force) the 328, so I'm going to assume it's bricked/corrupt.

beau-seidon commented 5 months ago

After your UNO is configured and your connections are made, launch Windows command prompt and paste this command in to burn the fuse bits (replace COM4 with the COM port for your own UNO):

avrdude -C "C:\Program Files (x86)\Arduino\hardware\tools\avr\etc\avrdude.conf" -v -p atmega328p -c stk500v1 -P COM4 -b 19200 -U lfuse:w:0xe0:m -U hfuse:w:0xd9:m -U efuse:w:0xff:m

It will launch avrdude, tell the application where to find the config file, tell it to print out what it's doing, tell it what kind of chip it will be programming, what programmer it will be using, and which COM port, baud rate, and the fuse bit values to write.

You may have to re-load the .hex file to the board afterward. If so, you already know how to do that. If you want to upload it with avrdude using your UNO use this command (update the COM port and path to your .hex file before executing):

avrdude -C "C:\Program Files (x86)\Arduino\hardware\tools\avr\etc\avrdude.conf" -v -p atmega328p -c stk500v1 -P COM4 -b 1

Try this ^. Use the command line. Copy and paste those commands to a text editor, update your COM port and .hex path, connect your programmer to the NESizer ISP header, then paste/run those in CMD. Fuse bits first.

I oopsed my chip once by accidentally disconnecting while flashing and it wouldn't do anything anymore. Couldn't flash a new program either. I fixed it by re-burning fuse bits, and then it would let me reprogram again.

jeff464 commented 5 months ago

I'm just getting this as a return:

avrdude: Version 5.10, compiled on Jan 19 2010 at 10:45:23 Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com Copyright (c) 2007-2009 Joerg Wunsch

     System wide configuration file is "C:\Program Files (x86)\Arduino\hardware\tools\avr\etc\avrdude.conf" syntax error at C:\Program Files (x86)\Arduino\hardware\tools\avr\etc\avrdude.conf:356

...

sorry about the formatting

beau-seidon commented 5 months ago

does that path exist and is there an avrdude.conf file in there?

I just noticed the ArduinoIDE on my work pc is not installed in "C:\Program Files (x86)". On my laptop the path above is correct. I found the file at the path "%LOCALAPPDATA%\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17\etc" by compiling and uploading a sketch in ArduinoIDE with verbose mode on.

You may have to update your path to the .conf file.

EDIT: can also skip all this hassle and use PlatformIO :)