# Building a MIDI keytar

##### Active Member
I seem to have blown up the PIC.
MJ , In my experience Its pretty difficult to 'Blow up' a PIC .. you sure .. what are its symptoms ?

#### MichaelaJoy

##### Active Member
It gets very hot and the ICD3 doesn't recognize it.

Also, it drags the power supply down.

##### Active Member
Uhoooo .. sounds like you blew it up ... only PIC24 I had get HOT was a FV series , with the Vcap wrong way round ! but you not using that one ..

#### MichaelaJoy

##### Active Member
LOL no. When I plugged it into the socket, I accidentally plugged it in "one-off".

Problem is, I have a 48 pin dip socket and the adapter is 44 pins.

Blew it up in a millisecond.

"The best lessons are the most costly".

##### Active Member
Ohh , I did count the socket in your picture . unusual 48 pin job.. Currently I have 44 pin breakout board mating with female headers , once got PIC round the wrong way , but noticed in time !!! bit late but , make a little blank plug with the 4 pins on ... OK you done that sorry ...

##### Active Member
MJ Seems a solution.. I had to lighten the picture to see it properly on my screen , presumably it presses the chip down on the copper .. how will you connect , sockets wires, I guess male pin headers , and socket wire links would help with swapping stuff around.. I prefer to solder to the TQFP break out boards.. but for a prototype guess be fine , ish ... Have you tried to replace the PIC chip on your board ..

#### MichaelaJoy

##### Active Member
I can't do it myself, as I've never worked with SMD at all.

I spoke to someone over at proto-advantage, and he said it's not worth having the IC changed by them.
Cheaper to just get a new one, which I've done.

It should be here by Monday, barring no delays because of snow.

Here's a better picture.

I'll more than likely get this one.

#### wkrug

##### Active Member
I can't do it myself, as I've never worked with SMD at all.
I would use TQFP 44 to DIP Adapters.
Like this:

To solder in a TQFP 44 Chip is no rocket science.
Look here:
The secret is to have enough flux - as shown in the video.
And the Pads have to have a good surface.
The solder wire should be very thin about 0.2 to 0.5mm will work.
When the pcb is older, make new solder at the pads and suck it up with solder suck wick, until the Pads are flat again.
Dont make the PCB to hot!
Then make a little solder at one pin in one edge.
Make flux at all pads of the PCB.
Positioning the IC, with a pincette, that the pins laying in the middle of the pads all around the chip.
Then heat up the pre soldered pin to fix the IC.
When all fits solder one opposite pin onto the PCB.
Check if all fits.
Then make a little solder at the solder iron and go along all pins at one side - as shown in the video.
Go along in the edge between the IC pins and the pads.
Solder in so all the pins.
When there are connection between the pins get them out with solder suck wick until all is fine.
You can use a magnifying glass to do this.

With a little practice it works like shown in the video.
The solder tip has not to be too small.
I guess 1.5 up to 2mm is a good size.
With too small tip's You dont get enough heat to the pins and the result is an cold solder joint.

Last edited:

##### Active Member
W ... Agree the key words are
With a little practice
, and a flux pen but you need some old un-populated boards .. I found after tagging the TQFP corners and soldering one side , to use solder wick across the all the pins ( one side ) then with iron and heat and drag the braid out and off , leaves the 'legs' perfect.. clean up with isopropyl alcohol (IPA 170 ). I succeeded with a 100 pin .4 mm chip this way. (my previous post )
[Ed] the video... person solders the pads first ... No... the chip will be uneven and will require excess solder to bridge any high pins ... I place the chip clamp it and tag the corners. then solder the pins .. remove any excess / bridges with braid.

The next video was much better and no oribl "music"

Last edited:

#### MichaelaJoy

##### Active Member
Once I'm sure that everything is working, I'll try my hand at SMD soldering.

Here's a pic of the rebuilt keytar. As you can see, I tightened everything up.

#### MichaelaJoy

##### Active Member
The new PIC arrived today. After two missed delivery attempts, they got it over to a place where I could pick it up.

So I started to check out the board, and it seems I took out the LDO regulator as well as the pic.
It's a good thing I had sense enough to order a couple of spares.

So I checked each component out (caps and resistors on a RCL bridge) and rebuilt the power supply.

So far, everything is as good as new.

I added a clock pin output. That should serve two purposes:

A) If there's a clock, the CPU is running.

and

B) I want to try state analysis on the logic analyzer. I can program the speed of this clock, so I should be able to set up some nice tests.

Let's see if I can get some nice pics of the keybed in action.

#### MichaelaJoy

##### Active Member
I've updated the schematic to reflect the new hardware changes.

See: Post #143 for the new schematic.

Over the next week or so, I will be taking a stab at SPI programming. The display subsystem is built and awaiting testing.

A good friend is starting on the actual case design this weekend, so I've been busy building the 'production' hardware.

When everything is working, I'll post some pics.

#### wkrug

##### Active Member
I've take a look to Your new schematic. That looks very fine.
I've calculated around with my own project and I figured out, that 1K EEPROM of my controller is too small for all the parameters that have to be stored.
In my case about 130 parameter are to store that allow only 7 setup spaces.
But I want to have about 100.
My Idea is to use an external IIC EEPROM to increase the space.
I'll suggest You to calculate a little bit too, to figure out if a external EEPROM is needed in Your case.

#### MichaelaJoy

##### Active Member
wkrug: Thanks.

That design has the 22pf caps on the signal lines coming from the keybed. (P1-P7 and S1-S7)
I don't think they'd be needed on a PCB because of the stray capacitance between the signal lines and the ground plane.

The signals are incredibly clean. You can actually see the delay between the primary and secondary switch lines..

I think understand what you mean. You're considering what would be stored in a preset,
perhaps making room for 128 presets?

Each of my presets look like this:

I have two layers. Each layer has the following fields:

0: Flags: (1 byte)
Bit #0: Use Fixed Velocity (0: Variable, 1: Fixed)
Bit #1: Split / Layer (0: Split, 1: Layer)

(I have room for 6 more bit parameters...)

1: MIDI Channel (0..15)
2: Transpose (By note) (-11..11)
3: Octave (-8..8)
4: Keyboard Split Start (Byte)
5: Keyboard Split End (Byte)
6: Velocity fixed value (1..127)
7: Pitch Bend scale (Upper 4 bits: Left end value,Lower 4 bits: Right end value)

So, that's 8 bytes per split or 16 bytes for the entire Preset.

for 128 presets, I would need 2048 bytes. (16 * 128)

So, I'll probably go for 16 presets (256 bytes), which should be more than I need.

#### wkrug

##### Active Member
So, I'll probably go for 16 presets (256 bytes), which should be more than I need.
Ok, then the internal EEPROM is huge enough.
I've planned in my Master Keyboard to insert 10Pots and 16Switches that all should be free programmable.
The Storage Name I would store too with 10 characters, and so I'll get about 130 Byte per one setting.

With that thing I would steer an Roland JV 880 complete per MiDi Remote.

##### Active Member
MJ . I expect your well versed with this PIC's data sheet The EEPROM / NV memory have a few 'hurdles' to code, there is an unlock sequence. also , interrupt issues and lengthy cycle time to read / write.. it is 256 words .. (It is actually top end of flash memory) , I did try and use it some time ago . but found an external EEprom easier !

#### MichaelaJoy

##### Active Member
I've been having a difficult time with SPI and getting this display to work.

So, I wanted to run some ideas here.
I want to run SPI2 as a SPI master with no interrupts at all.

Shutting off the SPI2 Interrupt should be easy. Just write an 0 to IEC2

To get SPI working, the directions of the ports need to be set. In my case, SPI2 is on TRISC.

RC3 36 SDI2
RC4 37 SDO2
RC5 38 SCK2

So, I'm thinking that RC3 has to be an input, and RC4 + RC5 has to be an output.

Here's my port init code
Code:
            mov.w    #0x000f,W0
mov        W0,TRISC
nop

clr        W0
mov        W0,ODCC
nop

mov        #7,W0
mov        W0,ANSC
nop

mov        #0x0100,w0
mov        w0,LATC
nop

_SPI2Initialize:
mov.w    #0x0320,w0
mov.w    w0,SPI2CON1
nop

clr.w    w0
mov.w    w0,SPI2CON2
return
Here's the display I have

https://www.digikey.com/catalog/en/partgroup/lcd-module-4x20/48932

I have the EA DIP203-4NLW. I soldered a jumper across the SPI pads (in the back of the display)

My backlight resistor is 680 ohms. I use a 5K trimpot to set contrast.

The logic analyzer shows me that I have SPI data on the connector.

I still haven't been able to get anything out of the display.

Will keep trying. Any ideas are definitely welcome.

##### Active Member
MJ Not sure if this correct module . did you solder the jumper .
is in pdf note ...
SERIAL MODE Factory setting for interface is parallel with 4 bit or 8 bit data bus. Alternatively the module can be used with serial data stream. For that, solder link SPI has to be closed. Specification for serial operation mode is described in user manual for
is this the serial data sheet ?
Also 680 ohms seems 6 x too high , is their a resistor on the display to limit back lite ? some do some dont ...
Not done SPI but don't you need a 'select / enable 'on the slave.

#### MichaelaJoy

##### Active Member
MJ Not sure if this correct module . did you solder the jumper .
is in pdf note ...
SERIAL MODE Factory setting for interface is parallel with 4 bit or 8 bit data bus. Alternatively the module can be used with serial data stream. For that, solder link SPI has to be closed. Specification for serial operation mode is described in user manual for
is this the serial data sheet ?
Also 680 ohms seems 6 x too high , is their a resistor on the display to limit back lite ? some do some dont ...
Not done SPI but don't you need a 'select / enable 'on the slave.
That's the one. I soldered the jumper for SPI.

Yes. You need the resistor or you can fry the backlight. I chose 680 ohms, but do you think. it needs to be less?
Maybe changing it to 470 ohms? The backlight looks pretty bright. You can see it leaking out of the bottom of the housing around
the LCD.

Yes, it does. I soldered the CS to ground, which I believe enables it all the time.
That's something else I have to check. Does CS need to be grounded to enable the device? or does it need to be at Vdd?