Jump to content

NiHaoMike

Members
  • Content Count

    13
  • Joined

  • Last visited

  • Days Won

    2
  1. NiHaoMike

    Where would be a C2000 useful?

    Apart from motor drives, digital power supply control is a big use case. Also useful to drive haptic feedback devices ("vibrators") for gaming purposes. I'm actually working one one of those, albeit with a dsPIC processor. BTW, if you own a high performance PC, there's a decent chance there's at least one C2000 in it for the cooling fan drive. More on DIY hobby electronics, a closely related application would be drones and other hobby aircraft.
  2. The pinout convention for a 3 pin SBW header is TST, RST, GND. Pretty minor, though, so if you already settled on the other way, it's OK. Or add another GND hole on the other side of the header so you can choose which side to put the ground when you solder in the header.
  3. NiHaoMike

    MSP430-based Controller, CPC430

    Any reason it doesn't have a PWM output? On/off relay control is so last century.
  4. NiHaoMike

    OpenDAC HD: an open hardware HD audio DAC

    The volume control is a rotary encoder on the front panel. The motor was left in simply because it was too difficult to remove. Once the top cover is screwed on, the entire unit is quite well shielded. That "freestyle" construction method was good enough for Jim Williams. There are more pictures on the Github, including schematics, output waveform comparisons, and even a picture of my best friend and I holding the unit.
  5. I recently got a renewed interest in HD audio and decided to work with my best friend on an open source HD DAC. I selected MSP430 since it's easy to work with using Energia and an Arduino is overkill for what I'm using it for. (I normally use PICs, but then my friend, who is new to embedded programming, would have a hard time contributing.) https://github.com/NiHaoMike/OpenDAC-HD
  6. NiHaoMike

    Stuck with a 7 Segment Display and a Button...

    Add a delay (200ms or so) before exiting the ISR to mask switch bounce.
  7. NiHaoMike

    Launchpad as HID Keyboard/Mouse

    There are cheap PS/2 to USB converters out there, which would mean that you only need to implement PS/2. There are also chips like the Maxim MAX3420/MAX3421 that allow interfacing to USB over SPI, but beware that USB is a very complex protocol. Or take apart a ball mouse and connect some GPIOs to the quadrature encoders and buttons. That is by far the easiest solution. In theory, it would work for keyboards as well, but all the connections (many GPIO expanders) would get messy very fast.
  8. NiHaoMike

    MSP430G2553 I2C slave

    Here is the entire project. The MSP430 does acknowledge the address byte, but locks up afterwards. Even if the address received is not correct, it needs to handle it properly since the I2C bus is shared with some other devices. dcdc.zip
  9. NiHaoMike

    Uart Laser Based SS

    Set the output low, check if the input is low after some delay, set the output high, check if the input is high after some delay. Repeat until a match fails.
  10. NiHaoMike

    MSP430G2553 I2C slave

    I changed from "interrupt void" to just "void", now it just infinite loops in I2C_Start and locks up the bus when I try to communicate with it. Is it necessary to manually clear the interrupt or release the clock?
  11. NiHaoMike

    MSP430G2553 I2C slave

    I now got it to respond, but the receive and transmit ISRs are still not triggering. Can you show me an example of using the USCI as an I2C slave in a Grace project?
  12. NiHaoMike

    MSP430G2553 I2C slave

    /* * ==== DO NOT MODIFY THIS FILE - CHANGES WILL BE OVERWRITTEN ==== * * Generated from * C:/Program Files/Texas Instruments/grace_1_00_01_83/packages/ti/mcu/msp430/csl/communication/USCI_B0_init.xdt */ #include /* * ======== USCI_B0_init ======== * Initialize Universal Serial Communication Interface B0 I2C 2xx */ void USCI_B0_init(void) { /* Disable USCI */ UCB0CTL1 |= UCSWRST; /* * Control Register 0 * * ~UCA10 -- Own address is a 7-bit address * ~UCSLA10 -- Address slave with 7-bit address * ~UCMM -- Single master environment. There is no other master in the system. The address compare unit is disabled * ~UCMST -- Slave mode * UCMODE_3 -- I2C Mode * UCSYNC -- Synchronous Mode * * Note: ~ indicates that has value zero */ UCB0CTL0 = UCMODE_3 + UCSYNC; /* * Control Register 1 * * UCSSEL_2 -- SMCLK * ~UCTR -- Receiver * ~UCTXNACK -- Acknowledge normally * ~UCTXSTP -- No STOP generated * ~UCTXSTT -- Do not generate START condition * UCSWRST -- Enabled. USCI logic held in reset state * * Note: ~ indicates that has value zero */ UCB0CTL1 = UCSSEL_2 + UCSWRST; /* * I2C Own Address Register * * ~UCGCEN -- Do not respond to a general call * * Note: ~UCGCEN indicates that UCGCEN has value zero */ UCB0I2COA = 24; /* Bit Rate Control Register 0 */ UCB0BR0 = 40; /* * USCI_Bx I2C Interrupt Enable Register * * ~UCNACKIE -- Interrupt disabled * UCSTPIE -- Interrupt enabled * UCSTTIE -- Interrupt enabled * ~UCALIE -- Interrupt disabled * * Note: ~ indicates that has value zero */ UCB0I2CIE = UCSTPIE + UCSTTIE; /* Enable USCI */ UCB0CTL1 &= ~UCSWRST; }
  13. NiHaoMike

    MSP430G2553 I2C slave

    In my senior design project, I have an Android tablet connected to a "Kelly Wu" USB host board (with a PIC24FJ64GB002 on it) that allows the tablet to be an I2C bus master. Connected to that bus is a MSP430G2553 that is used for advanced control of a DC/DC converter (MPPT, status reporting, parameter tuning, etc.). I'm having some problems with getting the MSP430 to act as an I2C slave. Checking the lines with a scope reveals that the MSP430 is not responding at all. main.c: (Some irrelevant parts like the timed ADC interrupt are left out for clarity.) #include #include #define DAC P2OUT int I2C_state=0; int mode=0; int var1=0; int var2=0; int var3=0; int var4=0; int timer=0; int raddr=0; int main(int argc, char *argv[]) { CSL_init(); // Activate Grace-generated configuration __enable_interrupt(); // Set global interrupt enable while(1) { } } interrupt void I2C_TX() { timer=0; switch(raddr) { case 0: //mode UCB0TXBUF=mode; break; case 1: //var1 UCB0TXBUF=var1; break; case 2: //var2 UCB0TXBUF=var2; break; case 3: //var3 UCB0TXBUF=var3; break; case 4: //var4 UCB0TXBUF=var4; break; case 0xF0: //ADC UCB0TXBUF=ADC10MEM>>2; break; case 0xF1: //DAC UCB0TXBUF=DAC; break; } } interrupt void I2C_RX() { timer=0; switch(I2C_state) { case 0: //idle break; case 1: //receive register address raddr=UCB0RXBUF; I2C_state=2; break; case 2: //receive data switch(raddr) { case 0: //mode mode=UCB0RXBUF; break; case 1: //var1 var1=UCB0RXBUF; break; case 2: //var2 var2=UCB0RXBUF; break; case 3: //var3 var3=UCB0RXBUF; break; case 4: //var4 var4=UCB0RXBUF; break; } I2C_state=0; break; } } interrupt void I2C_Start() { timer=0; I2C_state=1; } interrupt void I2C_Stop() { timer=0; I2C_state=0; } A breakpoint inside I2C_Start will trigger on I2C communication, but I2C_TX and I2C_RX never trigger.
×