dsPIC33FJ12GP202 midi synthesizer mcp4921 6n137

| July 24, 2024 Updated
dsPIC33FJ12GP202 midi synthesizer mcp4921 6n137

Parts Used: dsPIC33FJ12GP202 and MCP4921 My day job involves developing real-time algorithms for machine vision, but in my spare time I work with a Physicist who does NOAA research involving the use of low-power microcontrollers. When I first read about dsPIC, I was very curious about what it could do. I chose the dsPIC33 for my project and opted for the 16-bit 28-pin demo board for fast turnaround.

I decided a sound project would be a fun diversion. I’m not a great keyboard player, so I thought I’d try making something simple like a digital accordion. To get started, I buy a small MIDI controller, namely the Oxygen8 v2 from M-Audio. A small two-octave keyboard that makes no noise. I then set out to design a monophonic MIDI synthesizer that I could plug into a keyboard.

dspic33fj12gp202-purchased-demo-board-doesnt-have-dac

I wanted to write everything in C to save development time. The software starts by setting the dsPIC to operate at 39.614Mhz. To keep the output synchronized, I used a 32,768 Hz timer to increase the sampling rate. This left me plenty of time in the timer ISR to do what I needed for sound synthesis. To be safe, I wanted to have a DAC output rate of more than twice the target sample rate. At 16 bits per SPI write, the clock speed I used for SPI increased to about 1.24Mhz, giving me a maximum DAC output speed of about 77.4kHz.

Using the formulas provided in the datasheet, the value 78 I found was needed to achieve the MIDI standard baud rate of 31.25k. However, I noticed that the baud rate from my keyboard was slightly different, so I adjusted the baud rate accordingly. The value I found was 81.

I encountered two problems during development. The first was that the ground pins on the right side of the demo board, near the prototyping area, were floating (i.e. not connected to ground). The second problem was that the UART pins were remapable, but the Rx pin didn’t work where I first mapped it. This was hard to follow as the tx pin worked fine, but I couldn’t get any MIDI command bytes. Going through a list of possible problems, I tried remapping the Rx pin to a different location and everything was fine.

Project Block Diagram

dspic33fj12gp202-midi

The dsPIC33FJ12GP202 I purchased to fit the demo board does not have a DAC, so I added the MCP4921 12-bit SPI DAC. The other benefit of using an external DAC is, to me, Author: Michael Herman

parts-dspic33fj12gp202-mcp4921-involves-nonindustrial-real-time-algorithms

dsPIC33FJ12GP202 midi synthesizer mcp4921 6n137

Password: 320volt.com

Published: 2010/05/23 Tags: , ,



1 Comment “dsPIC33FJ12GP202 midi synthesizer mcp4921 6n137

  1. Electronics CircuitsElectronics Circuits

    LPC2138 arm enc28j60 microcontroller SMS

    The highly underspent system is fashioned around an LPC2138 microcontroller, which features an ARM7 Architecture processor. Built with a bitty handful of components, TAM-TAM’s designing is cost-effective. The considered involvement of an extrinsic minute retention cardboard and well-chosen algorithms for nearly infinite hardware content of crystal-clear messages further to the success of the programme.

    This quick overview allows us to build a laundry list of software features that are required to implement TAM-TAM:

    REPLY

Leave a Reply

Your email address will not be published. Required fields are marked *