Jump to content

GuiB

Members
  • Content Count

    7
  • Joined

  • Last visited

  • Days Won

    1
  1. GuiB

    MSP430 Launchpad - Midi Output

    Thanks guys for you respond !! Sorry for the little delay, was busy yesterday. But yes, you're right, this should be a timing issue. I found out that with Energia it put the clock to 1mhz, so I "unlocked" the 16mhz settings. RobG, I'm not sure about what you're saying when you say to make sure to use DCO calibration data. I didn't use a lot the launchpad, I more used the STM32F4DISCOVERY, but is it just to put the DCO clock to 16mhz ? I found on the Energia library the part where it initialize the clock. Should it be fine with those settings: void initClocks(void) { #ifdef __MSP430_HAS_BC2__ #if defined(CALBC1_16MHZ_) && F_CPU >= 16000000L BCSCTL1 = CALBC1_16MHZ; DCOCTL = CALDCO_16MHZ; #elif defined(CALBC1_12MHZ_) && (F_CPU >= 12000000L) BCSCTL1 = CALBC1_12MHZ; DCOCTL = CALDCO_12MHZ; #elif defined(CALBC1_8MHZ_) && (F_CPU >= 8000000L) BCSCTL1 = CALBC1_8MHZ; DCOCTL = CALDCO_8MHZ; #elif defined(CALBC1_1MHZ_) && (F_CPU >= 1000000L) BCSCTL1 = CALBC1_1MHZ; DCOCTL = CALDCO_1MHZ; #else #warning No Suitable Frequency found! #endif /* SMCLK = DCO / DIVS = nMHz */ BCSCTL2 &= ~(DIVS_0); /* ACLK = VLO = ~ 12 KHz */ BCSCTL3 |= LFXT1S_2; #endif #ifdef __MSP430_HAS_CS__ CSCTL0 = CSKEY; // Enable Access to CS Registers CSCTL2 &= ~SELM_7; // Clear selected Main CLK Source CSCTL2 |= SELM__DCOCLK; // Use DCO as Main Clock Source CSCTL3 &= ~(DIVM_3 | DIVS_3); // clear DIVM Bits #if F_CPU >= 24000000L CSCTL1 = DCOFSEL0 | DCOFSEL1 | DCORSEL; //Level 2 / Range 1 : 24.0MHz #elif F_CPU >= 16000000L CSCTL1 = DCORSEL; //Level 0 / Range 1 : 16.0MHz #elif F_CPU >= 12000000L CSCTL1 = DCOFSEL0 | DCOFSEL1 | DCORSEL; //Level 2 / Range 1 : 24.0MHz CSCTL3 |= DIVM_1; // Div = 2 #elif F_CPU >= 8000000L CSCTL1 = DCOFSEL0 | DCOFSEL1; //Level 2 / Range 0 : 8.0MHz #elif F_CPU >= 1000000L CSCTL1 = DCOFSEL0 | DCOFSEL1; //Level 2 / Range 0 : 8.0MHz CSCTL3 |= DIVM_3; // Div = 8 #else #warning No Suitable Frequency found! #endif // CSCTL0 = 0; // Disable Access to CS Registers #endif // __MSP430_HAS_CS__ } Thanks also to mention the USI module, I found the part of the Energia that they implement a USI for Spi mode. I'll have a look into it ! Right now, I've got the 16mhz clock and it changes the kind of midi data that I'm receiving, but not to something accurate. Thanks again for any tips ! I'll let you know my progress ! G
  2. Hi everyone, I'm trying to implement a midi output communication, but there seem to be a problem and I'm not sure if it's with my software or hardware. So here's what I'm getting... I'm trying to do it with a Launchpad rev 1.4 with the MSP430G2231 chip. I connected my launchpad to a midi connector like they told on the Teensy Midi Library page http://www.pjrc.com/teensy/td_libs_MIDI.html So translated to the launchpad: P1_1 (TX pin) to midi Pin 5 (tried with and without a 220 ohms resistor) GND to midi Pin 2 VCC to midi Pin 4 with a 220 ohms resistor For the VCC, I tried with the VCC pin for a +3.3v and with the TP1 connection (5v from the usb connector) for a +5v, but I get the same result with both. Since midi is a +5v protocol, I tried to amplify the TX signal with the circuit on this page but this didn't work. I found here and here that I could make it works with a +3.3v circuit by lowering the 220 ohms resistor to something about 50 ohms, but this give me the same results as with the 220 ohms. My results: I'm able to receive a midi value when I send it with no amplification to the TX pins (with 3.3v or 5v VCC). That's great, but I'm only getting a Midi Program change of ProgramChange 0 channel 1 when I try to send a midi note value (with note values of about half and up the midi scale). Over USB, I get the serial data and with this software I see that it sends a midi message that 1 or 2 byte is missing. With the MIDI connector, I plug it straight into my computer with a midi-to-usb cable (M-Audio Uno) For the code, mainly the midi example on the Energia IDE: /* MIDI note player This sketch shows how to use the serial transmit pin (pin 1) to send MIDI note data. If this circuit is connected to a MIDI synth, it will play the notes F#-0 (0x1E) to F#-5 (0x5A) in sequence. The circuit: * digital in 1 connected to MIDI jack pin 5 * MIDI jack pin 2 connected to ground * MIDI jack pin 4 connected to +5V through 220-ohm resistor Attach a MIDI cable to the jack, then to a MIDI synth, and play music. created 13 Jun 2006 modified 30 Aug 2011 by Tom Igoe This example code is in the public domain. http://www.arduino.cc/en/Tutorial/MIDI */ void setup() { // Set MIDI baud rate: Serial.begin(31250); } void loop() { // play notes from F#-0 (0x1E) to F#-5 (0x5A): for (int note = 0x1E; note < 0x5A; note ++) { //Note on channel 1 (0x90), some note value (note), middle velocity (0x45): noteOn(0x90, note, 0x45); delay(100); //Note on channel 1 (0x90), some note value (note), silent velocity (0x00): noteOn(0x90, note, 0x00); delay(100); } } // plays a MIDI note. Doesn't check to see that // cmd is greater than 127, or that data values are less than 127: void noteOn(byte cmd, byte pitch, byte velocity) { Serial.write(cmd); Serial.write(pitch); Serial.write(velocity); } Thanks a lot for any help ! G
  3. Just saw your post above... Thanks for your reply and all your informations!! I like your idea for the port name I think it will be relevant in the software I want to write as well! Keep the good work !! But right now, I was just using MaxMSP to see if I can get the launchpad to communicate with the computer... I was just reading the output of the serial object... So not so much at the moment, but I planned to use a microcontroller for my master degree in music composition and was struggling to decide which microcontroller to use. Right now, I think the launchpad could be a good one to use but still need some thought ... What I want to do is to build an hyper guitar and have multiple sensors connected and use the microcontroller to receive and send data between the guitar and the computer... Right now I'm just using MaxMSP for fast debugging and testing, but I planned to make my own software in Python and using a module for digital sound processing named pyo that one of my tutor made (http://code.google.com/p/pyo/). So, a lot fun on my way !! For bluehash, MaxMSP is a visual programming environment for music and multimedia developped by Cycling74. You connect objects together to build the patch ("program") like in Quartz Composer. It could be used as a parser for Arduino since there are objects for serial communication as well as some made by user especially to communicate with and Arduino (see Maxuino to name one)
  4. Well, now I think the problem is more between the IORegistryExplorer and MaxMSP than your driver for the Launchpad. I opened the IORegistryExplorer and then MaxMSP (without the launchpad connected) and now it was my usb port who stopped working (my usb mouse stopped) and both applications froze and needed to force quit and restart my computer... So, I'll continue to test without both application open and let you know if I got any other bugs
  5. Hi PentiumPC, thank you very much !! With that new version, my computer detect it and it looks the same as you mention in my IORegistryExplorer except that instead of mentioning "AppleUSBCDC", it says : "IOUSBCompositeDriver" (see the attachment). Not sure if that's a problem... but nevertheless, I see a new device in the terminal with ls /dev/tty.* named "uart-ABFF427A4D19511A" and I was able to get data in MaxMSP from the demo code inside the launchpad !! So, I'm quite happy with it !! I just got some problems, at two times my keyboard stopped from working... not sure exactly what did that... I tried to repeat it, but couldn't. At first, it happen when I started MaxMSP and the launchpad was already plugged and the other time I'm not sure exactly what did it, but both time it froze the IORegistryExplorer and the MaxMSP application and then I needed to force reboot if I wanted to get back my keyboard working. However, after two reboot now it seems fine... I'll let you know if I found the problem! Maybe its because I'm still on 10.6.6... I know I need to upgrade So thank you again for your work !! Very appreciated !! I made a mistake while uploading my picture of the IORegistry on my post before. In the application, I made a search for "msp" so I was only getting things with "msp" written. So there was no "IOUSBCompositeDriver" or any others. But, nevertheless, it wasn't exactly like the picture you showed me. I took a screenshot at that time so here they are: (First with 1.0.2b and second with 1.0.3b)
  6. Ok thanks !! Is there a place I can download this previous version ?? Or can someone PM me to get it ?? Thanks
  7. Thanks very much for your effort !! This is some pretty great news on the OS X side !! But unfortunately, I can't make it run for I don't know which reason... Well, the driver seems to be installed but I can't seem to be able to use it for Serial communication... I had previously tried the ez430rf2500.kext driver as well as to make one with the TIVCPSerial.kext... So I installed your driver (version "MSP430LPCDC 1.0.2b" with your installer) and uninstalled the others. In the I/ORegistryExplorer I can see the "Texas Instruments MSP-FET430UIF" when I connect the launchpad like that (See the attachment for a picture). Also, in the terminal, I can't see it when I type: ls /dev/tty.* (See other attachment) So, just wondering if you know what could be the problem... Any helps will be a great welcome To let you know, I'm using a macbook pro late 2008 with OS X 10.6.6 Thanks in advance !!
×