• Announcements

    • bluehash

      Forum Upgrade   03/11/2017

      Hello Everyone, Thanks for being patient while the forums were being fixed and upgraded. Please see details and report issues in this thread. Thanks!

maelli01

Members
  • Content count

    44
  • Joined

  • Last visited

  • Days Won

    12

Everything posted by maelli01

  1. The example msp430fr5994x_lpm4-5_02.c is supposed to show how little current is used in this mode. In the file it says: // MSP430FR5x9x Demo - Entering and waking up from LPM4.5 via P1.3 interrupt // with SVS disabled // // Description: Download and run the program. When entered LPM4.5, no LEDs // should be on. Use a multimeter to measure current on JP1 and // compare to the datasheet. When a positive voltage is applied // to P1.3 the device should wake up from LPM4.5. This will enable // the LFXT oscillator and blink the LED (on P1.0). Even for a high-end multimeter this current is too low to be accurately measured. So I helped myself this way: - power the processor from the supercap - a 10k resistor with two antiparallel diodes act as a shunt, - connect the volt meter across the supercap, not across the processor 0.43mV over a 10k resistor gives 43 Nanoamps. (!) Yes, the datasheet (page 32) is right, typical value at 25°C is 45nA. A CR2032 (200mAh) cell would allow the processor to wait for an interrupt for 530 years.
  2. Did anybody been succesful in writing to the SD card on the FR5994? For me the out of the box demo does not work for SD-logging. When re-installing it, no idea whether it worked when originally came out of the box ;-( Is there a "hello world on SD card" example using the fr5994 around somewhere? update: yesterday it did not work and I did not know why today I got it working (the out of the box project) and I do not know why.... ;-)
  3. Weekend-project: Autoranging microvoltmeter based on the MSP430FR4133 launchpad. ADC used: MIcrochip MCP3422, an 18bit, 3.75 sample/second Sigma Delta with 2 differential inputs. I2C interface This nice little chip contains a programmable amplifier (x2,x4,x8) and a not-too-bad internal reference of 2.048V. Max input range is +/-2.048V, resolution (8x amplified) is 2uV. Hand-etched a single layer PCB which goes on top of Launchpad. Type K cable in hot water: 2.93mV, 73Kelvin temp difference to ambient compare with my Fluke 289, 0.06% (datasheet says 0.05% typical, 0.35% max) Not too shabby for a chip that costs 3 bucks. Current consumption: on average <40uA, the whole setup would run 5000hours from a CR2032 The ADC does 1 sample/second and sleeps the rest of the time, the MSP430 does what it likes the most: sleep in LPM3 Code is not a big deal, quick hack based on the FR4133 examples, for the LCD and for the I2C interface //microvolt meter with MCP3422 and MSP430FR413 //****************************************************************************** #include <msp430.h> #define LCDMEMW ((int*)LCDMEM) #define pos1 4 // Digit A1 - L4 #define pos2 6 // Digit A2 - L6 #define pos3 8 // Digit A3 - L8 #define pos4 10 // Digit A4 - L10 #define pos5 2 // Digit A5 - L2 #define pos6 18 // Digit A6 - L18 const char digit[10] ={ 0xFC, // "0" 0x60, // "1" 0xDB, // "2" 0xF3, // "3" 0x67, // "4" 0xB7, // "5" 0xBF, // "6" 0xE0, // "7" 0xFF, // "8" 0xF7 // "9" }; volatile long voltage; unsigned long dvoltage; unsigned char TXByteCtr; unsigned char TXData; unsigned char newgain,gain; void Clear_LCD(){ int i; for(i=5;i;i--) LCDMEMW[i]=0; LCDMEMW[9]=0; } int main( void ) { WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer P1OUT = 0x00;P2OUT = 0x00;P3OUT = 0x00;P4OUT = 0x00; P5OUT = 0x00;P6OUT = 0x00;P7OUT = 0x00;P8OUT = 0x00; P1DIR = 0xFF;P2DIR = 0xFF;P3DIR = 0xFF;P4DIR = 0xFF; P5DIR = 0xFF;P6DIR = 0xFF;P7DIR = 0xFF;P8DIR = 0xFF; P5SEL0 |= BIT2 | BIT3; // I2C pins // Configure XT1 oscillator P4SEL0 |= BIT1 | BIT2; // P4.2~P4.1: crystal pins do { CSCTL7 &= ~(XT1OFFG | DCOFFG); // Clear XT1 and DCO fault flag SFRIFG1 &= ~OFIFG; } while (SFRIFG1 & OFIFG); // Test oscillator fault flag // Disable the GPIO power-on default high-impedance mode // to activate previously configured port settings PM5CTL0 &= ~LOCKLPM5; CSCTL4 = SELMS__DCOCLKDIV + SELA__XT1CLK; // MCLK=SMCLK=DCO; ACLK=XT1 // Configure RTC RTCCTL |= RTCSS__XT1CLK | RTCIE; // Initialize RTC to use XT1 and enable RTC interrupt RTCMOD = 16384; // Set RTC modulo to 16384 to trigger interrupt twice a second // Configure LCD pins SYSCFG2 |= LCDPCTL; // R13/R23/R33/LCDCAP0/LCDCAP1 pins selected LCDPCTL0 = 0xFFFF; LCDPCTL1 = 0x07FF; LCDPCTL2 = 0x00F0; // L0~L26 & L36~L39 pins selected LCDCTL0 = LCDSSEL_0 | LCDDIV_7; // flcd ref freq is xtclk // LCD Operation - Mode 3, internal 3.08v, charge pump 256Hz LCDVCTL = LCDCPEN | LCDREFEN | VLCD_5 | (LCDCPFSEL0 | LCDCPFSEL1 | LCDCPFSEL2 | LCDCPFSEL3); LCDMEMCTL |= LCDCLRM; // Clear LCD memory LCDCSSEL0 = 0x000F; // Configure COMs and SEGs LCDCSSEL1 = 0x0000; // L0, L1, L2, L3: COM pins LCDCSSEL2 = 0x0000; LCDM0 = 0x21; // L0 = COM0, L1 = COM1 LCDM1 = 0x84; // L2 = COM2, L3 = COM3 LCDCTL0 |= LCD4MUX | LCDON; // Turn on LCD, 4-mux selected (LCD4MUX also includes LCDSON) Clear_LCD(); // Configure USCI_B0 for I2C mode UCB0CTLW0 |= UCSWRST; // Software reset enabled UCB0CTLW0 |= UCMODE_3 | UCMST | UCSYNC; // I2C mode, Master mode, sync UCB0CTLW1 |= UCASTP_2; // Automatic stop generated // after UCB0TBCNT is reached UCB0BRW = 0x0008; // baudrate = SMCLK / 8 UCB0I2CSA = 0x0068; // Slave address UCB0CTL1 &= ~UCSWRST; UCB0IE |= UCRXIE | UCNACKIE | UCBCNTIE | UCTXIE0; while(1){ // P1OUT |= BIT0; TXByteCtr = 1; // Load TX byte counter TXData = 0x8C+gain; while (UCB0CTLW0 & UCTXSTP); // Ensure stop condition got sent UCB0CTLW0 |= UCTR | UCTXSTT; // I2C TX, start condition // P1OUT &= ~BIT0; __bis_SR_register(LPM3_bits | GIE); // timer will wake me up // P1OUT |= BIT0; UCB0TBCNT = 0x0003; // 3 bytes to be received voltage=0; UCB0CTLW0 &= ~UCTR; while (UCB0CTL1 & UCTXSTP); // Ensure stop condition got sent UCB0CTL1 |= UCTXSTT; // I2C start condition __bis_SR_register(LPM3_bits | GIE); // I2C irq will wake me up voltage<<=8; // shift to left corner to do the sign correctly voltage/=32; // calibration is done here: 2048 in an ideal world if ((voltage<400000)&&(voltage>(-400000))){ // autoranging, downshift if (newgain<3) newgain++; } if ((voltage>1000000)||(voltage<-1000000)){ // autoranging, upshift if (newgain) newgain--; } voltage>>=gain; gain=newgain; if ((voltage<500000)&&(voltage>-500000)){ voltage*=10; //low range LCDMEM[11]&=~1; //adjust decimal point LCDMEM[9]|=1; } else{ //high range LCDMEM[9]&=~1; //adjust decimal point LCDMEM[11]|=1; } voltage*=25; voltage/=128; if (voltage<0) {dvoltage=-voltage; LCDMEM[5]|=4 ;} //negative else {dvoltage= voltage; LCDMEM[5]&=~4;} //positive LCDMEM[pos1] = digit[(dvoltage / 100000)%10]; LCDMEM[pos2] = digit[(dvoltage / 10000)%10]; LCDMEM[pos3] = digit[(dvoltage / 1000)%10]; LCDMEM[pos4] = digit[(dvoltage / 100)%10]; LCDMEM[pos5] = digit[(dvoltage / 10)%10]; LCDMEM[pos6] = digit[dvoltage % 10]; // P1OUT &= ~BIT0; __bis_SR_register(LPM3_bits | GIE); // timer will wake me up } } #pragma vector = RTC_VECTOR __interrupt void RTC_ISR(void){ switch(__even_in_range(RTCIV, RTCIV_RTCIF)){ case RTCIV_NONE: break; // No interrupt case RTCIV_RTCIF: // RTC Overflow __bic_SR_register_on_exit(LPM3_bits); break; default: break; } } #pragma vector = USCI_B0_VECTOR __interrupt void USCIB0_ISR(void){ switch(__even_in_range(UCB0IV, USCI_I2C_UCBIT9IFG)){ case USCI_NONE: break; // Vector 0: No interrupts case USCI_I2C_UCALIFG: break; // Vector 2: ALIFG case USCI_I2C_UCNACKIFG: // Vector 4: NACKIFG UCB0CTL1 |= UCTXSTT; // I2C start condition break; case USCI_I2C_UCSTTIFG: break; // Vector 6: STTIFG case USCI_I2C_UCSTPIFG: break; // Vector 8: STPIFG case USCI_I2C_UCRXIFG3: break; // Vector 10: RXIFG3 case USCI_I2C_UCTXIFG3: break; // Vector 14: TXIFG3 case USCI_I2C_UCRXIFG2: break; // Vector 16: RXIFG2 case USCI_I2C_UCTXIFG2: break; // Vector 18: TXIFG2 case USCI_I2C_UCRXIFG1: break; // Vector 20: RXIFG1 case USCI_I2C_UCTXIFG1: break; // Vector 22: TXIFG1 case USCI_I2C_UCRXIFG0: // Vector 24: RXIFG0 voltage=(voltage<<8)+UCB0RXBUF; break; case USCI_I2C_UCTXIFG0: // Vector 26: TXIFG0 if (TXByteCtr){ // Check TX byte counter UCB0TXBUF = TXData; // Load TX buffer TXByteCtr--; // Decrement TX byte counter } else{ UCB0CTLW0 |= UCTXSTP; // I2C stop condition UCB0IFG &= ~UCTXIFG; // Clear USCI_B0 TX int flag } break; case USCI_I2C_UCBCNTIFG: // Vector 28: BCNTIFG __bic_SR_register_on_exit(LPM3_bits); break; case USCI_I2C_UCCLTOIFG: break; // Vector 30: clock low timeout case USCI_I2C_UCBIT9IFG: break; // Vector 32: 9th bit default: break; } }
  4. Hioki multimeter MSP430F449 8:12
  5. Hello all I am building a temperature logging web server around a TM4C1294 LP and several "temperature bugs", little sensors built around a MSP430G2553 and I2C temp sensors. The web server is connected with these "bugs" via NRF24 modules. (at the moment only one active) The server logs the temperature data over long time and shows them on a table. Time is synced with NTP once an hour. I am using Energia 16 Everything works fine and as expected However, the whole system is not reliable. The more often I connect via web browser, the more likely it will simply not accept any connection and crash. Sometimes o.k. for four days, sometimes crashed after 24 hours. In order to trace down the problem, I inserted the auto-refresh: client.println("<META HTTP-EQUIV=\"refresh\" CONTENT=\"10\">"); Like this it is much worse, sometimes survive for an hour, sometimes crash after 15 minutes. Having two or three browser tabs open make it worse. Once crashed, no more communication over serial any longer. Only reset helps. Heart beat LED 1 constantly off. LED 2 and 3 are constantly on. So it seems to get blocked in the printIndex function, which mostly consists of client.println calls. Any suggestions? Is there anything I am doing wrong in my Ethernet code? (It is more or less copied from the example) Anybody has a TM4C1294 Launchpad running 24/7 as a simple webserver with the ethernet library? Thanks for any help or hint // temperature logger web server // Energia0101E0016, Board:tm4c129 #define temp_array 288 #define seconds_per_sample 600 #include <Ethernet.h> #include <EthernetUdp.h> #include <time.h> #include <Enrf24.h> #include <nRF24L01.h> #include <string.h> #include <SPI.h> EthernetServer server(80); EthernetClient client; Enrf24 radio(8, 12, 11); const uint8_t rxaddr[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0x01 }; const uint8_t txaddr[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0x01 }; byte mac[] = { 0x00, 0x1a, 0xB6, 0x02, 0xa8, 0xc2 }; byte myip[]= { 192,168,1,54}; unsigned int localPort = 8888; // local port to listen for UDP packets IPAddress timeServer(66,228,59,187); const int NTP_PACKET_SIZE= 48; // NTP time stamp is in the first 48 bytes of the message byte packetBuffer[NTP_PACKET_SIZE]; //buffer to hold incoming and outgoing packets unsigned long oldmillis; unsigned long oldepoch,epoch; float temperature; float temp24 [temp_array]; unsigned long time24 [temp_array]; int index24; int timeout_to_sync=30; // A UDP instance to let us send and receive packets over UDP EthernetUDP Udp; void setup() { Serial.begin(9600); Serial.println("UdpNtpClient setup"); pinMode(D1_LED, OUTPUT); pinMode(D2_LED, OUTPUT); pinMode(D3_LED, OUTPUT); SPI.begin(); SPI.setDataMode(SPI_MODE0); SPI.setBitOrder(MSBFIRST); radio.begin(); // Defaults 1Mbps, channel 0, max TX power radio.setSpeed(250000); radio.setRXaddress((void*)rxaddr); radio.setTXaddress((void*)txaddr); radio.enableRX(); // Start listening Ethernet.begin(mac,myip); Udp.begin(localPort); server.begin(); printEthernetData(); } void loop() { //read in temperature sensor (an MSP430G2553, sending the 2 bytes from an I2C temp sensor over NRF24) //once a minute char inbuf[33]; if (radio.read(inbuf)) { Serial.print("Received radio packet: "); Serial.println(inbuf[0]+inbuf[1]*256); if (inbuf[1] >> 7) { // negative temperature value temperature = float (((inbuf[1] << 1) | (inbuf[0] >> 7)) / 2 ) - 128; } else { // temperature value is positive temperature = float ((inbuf[1] << 1) | (inbuf[0] >> 7)) / 2; } Serial.print("Temperature: "); Serial.println(temperature); } //internet server starts here client = server.available(); if (client) { // if you get a client, digitalWrite(D1_LED, HIGH); Serial.print("new client on port "); // print a message out the serial port Serial.println(client.port()); String currentLine = ""; // make a String to hold incoming data from the client boolean newConnection = true; // flag for new connections unsigned long connectionActiveTimer; // will hold the connection start time int timeoutimer=millis(); while (client.connected()) { // loop while the client's connected if (newConnection){ // it's a new connection, so connectionActiveTimer = millis(); // log when the connection started newConnection = false; // not a new connection anymore } if (!newConnection && connectionActiveTimer + 1000 < millis()){ // if this while loop is still active 1000ms after a web client connected, something is wrong break; // leave the while loop, something bad happened } if (client.available()) { // if there's bytes to read from the client, char c = client.read(); // read a byte, then Serial.print(c); if (c == '\n') { // that's the end of the client HTTP request, so send a response: if (currentLine.length() == 0) { break; } else { // if you got a newline, then clear currentLine: currentLine = ""; } } else if (c != '\r') { // if you got anything else but a carriage return character, currentLine += c; // add it to the end of the currentLine } if (currentLine.endsWith("GET / ")){ digitalWrite(D2_LED, HIGH); printIndex(); digitalWrite(D2_LED, LOW); } } } client.stop(); digitalWrite(D1_LED, LOW); } // one second tick if (millis()>=(oldmillis+980)) digitalWrite(D3_LED, HIGH); if (millis()>=(oldmillis+1000)){ oldmillis=millis(); epoch++; digitalWrite(D3_LED, LOW); //sample the temperature into an array every now and then if(epoch%seconds_per_sample==0){ index24++; if (index24>=temp_array) index24=0; time24[index24]=epoch; temp24[index24]=temperature; } //short time after startup, then once an hour, sync with time server timeout_to_sync--; if(timeout_to_sync==1){ Serial.println("prepare sync with time server..."); sendNTPpacket(timeServer); // send an NTP packet to a time server } if (!timeout_to_sync){ timeout_to_sync=3600; if ( Udp.parsePacket() ) { // We've received a packet, read the data from it Serial.println("we got a signal..."); Udp.read(packetBuffer,NTP_PACKET_SIZE); // read the packet into the buffer unsigned long highWord = word(packetBuffer[40], packetBuffer[41]); unsigned long lowWord = word(packetBuffer[42], packetBuffer[43]); // combine the four bytes (two words) into a long integer // this is NTP time (seconds since Jan 1 1900): unsigned long secsSince1900 = highWord << 16 | lowWord; // Unix time starts on Jan 1 1970. In seconds, that's 2208988800: const unsigned long seventyYears = 2208988800UL; // subtract seventy years: epoch = secsSince1900 - seventyYears; epoch+=3600; //we are not in greenwich; +7200summmer, +3600winter oldepoch=epoch; } else{ Serial.println("sync failed!"); } } } } void printIndex(){ client.println("HTTP/1.1 200 OK"); client.println("Content-type:text/html"); client.println(); client.println("<html><head><title>Maelli 02</title></head><body align=left>"); client.println("<h1> <font color=\"red\">my little temp logger</font>"); client.println("<h2> <font color=\"green\">Current date is "); // UTC is the time at Greenwich Meridian (GMT) timeprint(epoch); client.println("</br><font color=\"blue\">Temperature now is: "); client.print(temperature); client.print(char(176)); client.println("C</font></h2>"); int index=index24+1; for (int a=0; a<temp_array; a++){ if (index) index--; else index=index+(temp_array-1); timeprint(time24[index]); client.println(" - "); client.print(temp24[index]); client.print(char(176)); //
  6. had this thing now running 24/7 for more than a year. Each time the ethernet library crashed, watchdog would trigger, count up one and restart the board. It crashed 32 times in the last 12 months. ;-) not often, but often enough to be a useless bit of kit. Has the problem been solved in the meantime? I have not been looking around in the forum much, but I have the impression that I am/was not the only one with issues. Could it make sense to upgrade to the latest energia?
  7. In the Horowitz/Hill Art of Electronics, third edition, design practices with discrete 74HCxxx, FPGA and Microprocessor are compared and discussed. As an example, the ultimate gibberish machine is described, a circuit that sends out a succession of pseudorandom bytes, as standard RS232 serial data, with 2 selectable speeds, 9600 / 1200 baud. Independent of the processor type, the implementation with a small micro and program it in C looks like the clear winner here, smallest engineering effort, lowest hardware effort (have to admit that I do not have the faintest idea about FPGA.) The example in the book used some 8051ish device, so I was wondering on how this would look like on a MSP430/launchpad See my code below, based on the 8051 C code from the book, but adapted to run as low power as possible (LPM3) The power consuption of this thing is: 40uA at 9600baud, 6uA at 1200baud //MSP430G2553LP implementation of the ultimate gibberish machine //from the art of electronics, third edition, Chapter 11.3. //Produces a pseudorandom datastream at 9600/1200baud, 8n1 //P1.0 output, sync, processor busy //P1.2 output, serial pseudorandom data //P1.3 input, data rate select (button,at start) //32768Hz crystal is required //2016-10-23 maelli01 #include <msp430.h> unsigned char d,c,b,a=1; int main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop WDT P1DIR = ~BIT3; P1REN=BIT3; P1OUT=BIT3; // all output, except button P1SEL = BIT2; P1SEL2=BIT2; // P1.2=TXD P2REN = 0x3F; // all unused pins resistor enable P3REN = 0xFF; // all unused pins resistor enable UCA0CTL1 |= UCSSEL_1; // CLK = ACLK if(P1IN&8){ // button not pressed: 9600 baud UCA0BR0 = 3; // 32768Hz/9600 = 3.41 UCA0MCTL = UCBRS1 + UCBRS0; // Modulation UCBRSx = 3 } else{ // button pressed: 1200 baud UCA0BR0 = 27; // 32768Hz/1200 = 27.3 UCA0MCTL = UCBRS1; // Modulation UCBRSx = 2 } UCA0BR1 = 0x00; UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine** IE2 |= UCA0TXIE; // Enable USCI_A0 TX interrupt __bis_SR_register(LPM3_bits + GIE); // Enter LPM3 w/ int } #pragma vector=USCIAB0TX_VECTOR __interrupt void USCI0TX_ISR(void){ P1OUT |=1; UCA0TXBUF=((d<<1)|(c>>7))^c; // 32 bit pseudorandom generator d=c; c=b; b=a; a=UCA0TXBUF; P1OUT &=~1; }
  8. Hi there Here is my 3phase variable speed motor drive booster pack This has been in my mind for some years, but I always thought that a 3phase variable speed inverter drive is beyond my humble hobbyist scope. Too complicated for my old 8-bit mind ;-) Such a inverter contains: 6 high voltage FETs or IGBTs, 6 gatedrives, at least one DSP, a protection concept, all the software to create the 3-phase PWM, dead time control..... Still that was for quite some time on my long-term "to do" list, with no chance to actually materialize it, not enough time, too many other things to do. When playing around with the PWM module of the TM4C123 I found out that creating a 3phase PWM signal with this module is actually pretty easy. Combined that with an integrated Power Module such as the FSB50550 (Fairchild). So here it is: a booster pack for the Tiva Launchpad which drives big-ass 3phase motors. The booster pack contains the following: - the FSB50550 power module (6 FETs 500V 1.4Ohm, Gatedrivers, Bootstrap diodes, Temp sensor) - snubber capacitor Power supply: everything is powered from one DC source, 20V or (much) more. - 15V switchmode power supply from the high voltage side, built around a LNK304, for the FSB50550 - 3.3V switchmode power supply from the 15V to power the Launchpad, built around a LT1376 Measurement: - Passive voltage dividier to measure the input voltage - Sense resistor and LM339 comparator for overcurrent detection Display: - Nokia 5110 display Potentiometer for motor speed and direction The software is based on Energia using Tiva Ware function calls for all the PWM stuff. It is still work in progress, very basic and at the moment consists of: - calculate the sinwave lookup table at startup - PWM initialisation (PWM set to 15625 Hz, deadtime 1us, sync on) - a timer interrupt run every 10uSecs, do update the 3 PWD duty cycles - ADC measurement of temperature, voltage, current (moving average) - fault interrupt The main program is very short, the display is updated twice a second and the modulation factor is calculated out of the potentiometer speed setting and the applied DC voltage. Sudden changes in motor frequency are limited in the software, to prevent the motor to feed back energy and cause overvoltage. The motor on the picture is a 1/2hp, 900rpm, 6-pole motor, 12 kg of Italian steel and copper, probably 50 years old. For playing around, I apply about 50% of rated volt/hz, so current and maximum torque is reduced. Currently I use my dual 35V 4A lab supply, series connected, as a power source. here is the code: //simple 3phase frequency converter //27.9.2014 by maelli #define dots 192 //dots per halfhave, must be divisible with 3 #define period 5120 //80Mhz/5120 = 15625 switching frequency #define dt 80 //deadtime 80Mhz / 80 = 1uS #define PART_TM4C123GH6PM #include <stdint.h> #include <stdbool.h> #include "inc/hw_ints.h" #include "inc/hw_sysctl.h" #include "inc/hw_types.h" #include "driverlib/interrupt.h" #include "driverlib/sysctl.h" #include "driverlib/timer.h" #include "driverlib/pwm.h" #include "LCD_5110.h" #include "inc/tm4c123gh6pm.h" LCD_5110 myScreen (33,37,36,35,34,38,17); char celsius[3]={0x7f,'C',0x00}; uint16_t a,dire=0,modu,tensec; uint32_t timecount,sintable[dots]; volatile int32_t irqcount,timeset; volatile uint32_t temperature, voltage, current, poti; void setup(){ myScreen.begin(); myScreen.setBacklight(0); myScreen.text(0, 0, "3ph Converter"); for(int i=0;i<dots;i++) sintable[i]=sinf((i*3.14159)/dots)*(period/2-dt); unsigned long ulPeriod; unsigned int Hz = 10000; // interupt frequency in Hz ulPeriod = (SysCtlClockGet() / Hz); initTimer(); charge_gdu(); ROM_TimerLoadSet(TIMER0_BASE, TIMER_A,ulPeriod -1); initPWM(); } void loop(){ if (irqcount>499) { //20x per sec irqcount-=500; int32_t fsoll=732*(poti-16384); int32_t diff=fsoll-timeset; if (diff>0){ if (diff>150000) timeset+=150000; else timeset=fsoll; } else { if (diff<-150000) timeset-=150000; else timeset=fsoll; } modu=abs(timeset)/voltage/16; if (modu<(32000/voltage)) modu=32000/voltage; if (modu>256) modu=256; tensec++; if (tensec==10) { //2x per sec we display something tensec=0; myScreen.text(0, 1, mkstrg((temperature-325)/24,2)); myScreen.text(2, 1, celsius); myScreen.text(5, 1, mkstrg((voltage)/23,3)); myScreen.text(8, 1, "Volt"); myScreen.text(0, 2, mkstrg(abs(timeset)/322122,2)); myScreen.text(2, 2, "."); myScreen.text(3, 2, mkstrg(abs((timeset/32212)%10),1)); myScreen.text(4, 2, "Hz"); myScreen.text(7, 2, mkstrg(current,4)); myScreen.text(11, 2, "mA"); if (timeset<0) myScreen.text(0, 3, "links "); else myScreen.text(0, 3, "rechts"); } } } String mkstrg(int d,uint8_t l){ char display[l+1]; int q=1; display[l]=0; for (uint8_t a=l;a;a--){ display[a-1]=0x30+(d%(q*10))/q; q*=10; } return display; } void initTimer(){ ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0); ROM_TimerConfigure(TIMER0_BASE, TIMER_CFG_PERIODIC); // 32 bits Timer TimerIntRegister(TIMER0_BASE, TIMER_A, Timer0Isr); // Registering isr ROM_TimerEnable(TIMER0_BASE, TIMER_A); ROM_IntEnable(INT_TIMER0A); ROM_TimerIntEnable(TIMER0_BASE, TIMER_TIMA_TIMEOUT); } void charge_gdu(){ ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); ROM_GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_0 ); ROM_GPIOPadConfigSet(GPIO_PORTF_BASE,GPIO_PIN_0,GPIO_STRENGTH_4MA,GPIO_PIN_TYPE_STD); GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_7); //alle 3 oberen ausschalten HWREG(GPIO_PORTA_BASE + (GPIO_PIN_7 << 2)) = 0; GPIOPinTypeGPIOOutput(GPIO_PORTD_BASE, GPIO_PIN_1); HWREG(GPIO_PORTD_BASE + (GPIO_PIN_1 << 2)) = 0; GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_3); HWREG(GPIO_PORTF_BASE + (GPIO_PIN_3 << 2)) = 0; GPIOPinTypeGPIOOutput(GPIO_PORTD_BASE, GPIO_PIN_0); //auch die 2 letzten aus HWREG(GPIO_PORTD_BASE + (GPIO_PIN_0 << 2)) = 0; GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_2); HWREG(GPIO_PORTF_BASE + (GPIO_PIN_2 << 2)) = 0; GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_6); //den ersten unteren ein HWREG(GPIO_PORTA_BASE + (GPIO_PIN_6 << 2)) = GPIO_PIN_6; delay(1); HWREG(GPIO_PORTD_BASE + (GPIO_PIN_0 << 2)) = GPIO_PIN_0; delay(1); HWREG(GPIO_PORTF_BASE + (GPIO_PIN_2 << 2)) = GPIO_PIN_2; delay(1); } void initPWM(){ ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_PWM1); //The Tiva Launchpad has two PWM modules (0 and 1). We are using 1 ROM_GPIOPinConfigure(GPIO_PD0_M1PWM0); ROM_GPIOPinConfigure(GPIO_PD1_M1PWM1); ROM_GPIOPinConfigure(GPIO_PA6_M1PWM2); ROM_GPIOPinConfigure(GPIO_PA7_M1PWM3); ROM_GPIOPinConfigure(GPIO_PF2_M1PWM6); ROM_GPIOPinConfigure(GPIO_PF3_M1PWM7); ROM_GPIOPinConfigure(GPIO_PF4_M1FAULT0); ROM_GPIOPinTypePWM(GPIO_PORTD_BASE, GPIO_PIN_0 | GPIO_PIN_1 ); ROM_GPIOPinTypePWM(GPIO_PORTA_BASE, GPIO_PIN_6 | GPIO_PIN_7 ); ROM_GPIOPinTypePWM(GPIO_PORTF_BASE, GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4); PWM1_0_FLTSEN_R =3; //PWM fault inverted see page 1169 GPIO_PORTF_PUR_R=0x10; //weak pullup for Pin 4 ROM_PWMGenConfigure(PWM1_BASE, PWM_GEN_0, PWM_GEN_MODE_UP_DOWN | PWM_GEN_MODE_SYNC | PWM_GEN_MODE_FAULT_LEGACY); ROM_PWMGenConfigure(PWM1_BASE, PWM_GEN_1, PWM_GEN_MODE_UP_DOWN | PWM_GEN_MODE_SYNC | PWM_GEN_MODE_FAULT_LEGACY); ROM_PWMGenConfigure(PWM1_BASE, PWM_GEN_3, PWM_GEN_MODE_UP_DOWN | PWM_GEN_MODE_SYNC | PWM_GEN_MODE_FAULT_LEGACY); ROM_PWMGenPeriodSet(PWM1_BASE, PWM_GEN_0, period); ROM_PWMGenPeriodSet(PWM1_BASE, PWM_GEN_1, period); ROM_PWMGenPeriodSet(PWM1_BASE, PWM_GEN_3, period); ROM_PWMDeadBandEnable(PWM1_BASE, PWM_GEN_0, dt,dt); ROM_PWMDeadBandEnable(PWM1_BASE, PWM_GEN_1, dt,dt); ROM_PWMDeadBandEnable(PWM1_BASE, PWM_GEN_3, dt,dt); ROM_PWMSyncTimeBase(PWM1_BASE,PWM_GEN_0_BIT |PWM_GEN_1_BIT|PWM_GEN_3_BIT); ROM_PWMGenEnable(PWM1_BASE, PWM_GEN_0); ROM_PWMGenEnable(PWM1_BASE, PWM_GEN_1); ROM_PWMGenEnable(PWM1_BASE, PWM_GEN_3); delay(1); PWMFaultIntRegister(PWM1_BASE, oh_shit); ROM_PWMIntEnable(PWM1_BASE,PWM_INT_FAULT0); ROM_PWMOutputState(PWM1_BASE, PWM_OUT_0_BIT | PWM_OUT_1_BIT | PWM1_BASE | PWM_OUT_2_BIT | PWM_OUT_3_BIT |PWM_OUT_6_BIT | PWM_OUT_7_BIT, true); } void Timer0Isr(void) { //10000x per second ROM_TimerIntClear(TIMER0_BASE, TIMER_TIMA_TIMEOUT); // Clear the timer interrupt irqcount++; timecount+=timeset; // 1 Hz is 192x256*256*256/10000=322122.5 if (timecount> 0xEFFFFFFF) timecount+=0xC0000000; if (timecount> 0xBFFFFFFF) timecount-=0xC0000000;; a=timecount>>16; a=a/(16384/(dots/3*2)); //a immer kleiner 2*dots: C000 *dots/3*2/ 4000= 12 *dots/3*2/4= 2*dots if (a<dots)ROM_PWMPulseWidthSet(PWM1_BASE, PWM_OUT_0,period/2+sintable[a]*modu/256); else ROM_PWMPulseWidthSet(PWM1_BASE, PWM_OUT_0,period/2-sintable[a-dots]*modu/256); a=a+dots*2/3; if (a>=2*dots) a-=2*dots; if (a<dots)ROM_PWMPulseWidthSet(PWM1_BASE, PWM_OUT_2,period/2+sintable[a]*modu/256); else ROM_PWMPulseWidthSet(PWM1_BASE, PWM_OUT_2,period/2-sintable[a-dots]*modu/256); a=a+dots*2/3; if (a>=2*dots) a-=2*dots; if (a<dots)ROM_PWMPulseWidthSet(PWM1_BASE, PWM_OUT_6,period/2+sintable[a]*modu/256); else ROM_PWMPulseWidthSet(PWM1_BASE, PWM_OUT_6,period/2-sintable[a-dots]*modu/256); ROM_PWMSyncUpdate(PWM1_BASE,PWM_GEN_0_BIT |PWM_GEN_1_BIT|PWM_GEN_3_BIT); switch(irqcount%10){ case 0: temperature=(temperature*127+analogRead(26))/128; break; case 1: voltage=(voltage*31+analogRead(27)*3)/32; break; case 2: current=(current*127+analogRead(25)*8)/128; break; case 3: poti=(poti*127+analogRead(28)*8)/128; break; } } void oh_shit(void) { //in case of severe overcurrent we shut down! ROM_PWMFaultIntClearExt(PWM1_BASE,PWM_INT_FAULT0); ROM_PWMOutputState(PWM1_BASE, PWM_OUT_0_BIT | PWM_OUT_1_BIT | PWM1_BASE | PWM_OUT_2_BIT | PWM_OUT_3_BIT |PWM_OUT_6_BIT | PWM_OUT_7_BIT, false); }
  9. it is a long time ago since I hacked this together. For the LNK304 based 15V supply I more or less followed this: https://ac-dc.power.com/design-support/reference-designs/design-examples/der-231-132-w-power-supply/ Adapt R8 and R9 for different output voltage. The UF4007 is a cheap but rather fast diode, a normal 1N4007 will NOT work. I found this LNK chips very easy to use. But yes, these things handle high voltage without potential separation. I always use a separation transformer when experimenting and keep my hands im my pockets...
  10. sure you can power an MSP430 from 2 AA cells. The unequal power drain should be manageable for a hobby project. However, for a "product" it is probably not a too good idea: - what happens when inserting / removing batteries? - 2 cells discharged during months, 2 others not, might be o.k. for alkalines, but for long term using Nimh? I do not know. - The MSP can use the internal reference for battery voltage measurement. You have to check the datasheet whether the 1.5V reference works when 2 cells are at the end of life. - you might also check for wrong polarity. The german clever designers solved this issue mechanically. It does not give contact when in wrong direction.
  11. Last year my daughter (she was almost 7 back then) got interesting in soldering. So I let het solder stuff together, no function whatsoever. It did not last long, until she wanted to solder something that "does something". So I took the challenge and designed this christmas tree. - FR2 board, copper artwork by me, other side by my daughter. (cheap FR2 is better for using felt tip pens.. almost like paper) - G2553, all 16pins to simple LEDs, various colours - simple discrete regulator (another led+ transistor) for more or less 3V - powered by USB - mostly through-hole (soldered by a 7 year old), some SMD (where I helped) - programmed in Energia merry christmas!
  12. Bike light follow-up: reverse engineering time! here is my almost complete circuit diagram. IC1 is a voltage regulator: 2.5V, exact type I could not find out. Only the MSP runs on the regulated voltage, all the rest runs from the raw battery voltage. Voltage divider R2 1M / R3 330K measure the battery voltage (some microamps get lost here) LED2 and 3 are indicator (red/green) LED1 is the power led PWM is 20kHz, coming from pin 11 of the MSP. Main switch is a Si4562, N and P channel 20V 5A mosfet. Inductor is 100uH. Instead of using only the upper fet, they alternately switch on the upper / lower FET, avoiding one diode voltage drop, increasing effiency. The circuitry around IC3 (a weird CMOS 4572) creates a small dead time (less than a microsecond) to avoid cross-conduction. Note the resistors in the signal path ;-) They managed to regulate the LED current without a shunt resistor. Took me some time to find out how: The voltage across the inductor is low-pass filtered, R14 390k / C4 0.1u, then fed into the MSP. Of course the DC-part of the inductor voltage depends on the current flow. Pretty clever. The regulation is rather slow (ramp-up of current is so slow it is actually visible). The circuitry around Q8 and Q9 takes care of the battery charge turn on/off. Input is from a wall-wart adaptor which is 500mA constant current type. R10/R11 tell the MSP that external voltage is present.
  13. power an msp430 without power pins ;-) http://www.eevblog.com/2015/12/18/eevblog-831-power-a-micro-with-no-power-pin/
  14. Reading this discussion on e2e.ti.com does not give me a good feeling. Seems like nobody wants to solve the problem or even admit there is one :-( meanwhile I added a watchdog (4secs) into my code. I feed the dog after the client.print function calls. The watchdog triggers more often than not. I have the strong feeling that sometimes the client.print(xx); function gets stuck in nowhereland for ever. Not good. With the device resetting every now and then, I cannot log any data.
  15. It is was a Busch & M
  16. My high tech, German street legal, bicycle light failed. Corrosion on the battery contacts, one day it worked, the other not. So I cracked the damn thing open. Solid build quality, waterproof, but not built to be repairable. As far as I remember, I bought it back in 2006. So what is inside: An MSP430F1122, doing all the business: - Battery charge termination (four AA NIMH) - Two LED intensity levels PWM - 2 color status led (blink duty cycle would indicate remaining charge) - Pushbutton, long for on/off, short for low/high The electronics still works fine, but would need a lot of duct tape to make it a cycle light again :-(
  17. converted the watchdog example from Tivaware into Energia. it should explain itself... I tested this with the connected launchpad TM4C1294 5 blinks, resets itself, 5 blinks, on and on.... /* 6.11.2015 Watchdog example */ #define LED RED_LED #include <stdint.h> #include <stdbool.h> #include "driverlib/sysctl.h" #include "driverlib/watchdog.h" unsigned long oldmillis; unsigned int timeout; void setup() { pinMode(LED, OUTPUT); SysCtlPeripheralEnable(SYSCTL_PERIPH_WDOG0); WatchdogReloadSet(WATCHDOG0_BASE,120000000); WatchdogResetEnable(WATCHDOG0_BASE); } // the loop routine runs over and over again forever: void loop() { if (millis()>(oldmillis+500)){ oldmillis=millis(); digitalWrite(LED, HIGH); delay(100); digitalWrite(LED, LOW); timeout++; WatchdogReloadSet(WATCHDOG0_BASE,120000000); //feed the dog, food for a second ;-) // simulated software crash: dog will not be fed any longer, causing a reset if (timeout>5){ while(1); } } }
  18. Did anybody manage to get the SNTP client (NTP, TIRTOS) working on a EK-TM4C1294XL launchpad? I found this http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/ndk/2_24_03_35/exports/ndk_2_24_03_35/docs/doxygen/html/sntp_8h.html and this http://e2e.ti.com/support/embedded/tirtos/f/355/p/430488/1549602 but did not help me much, too confusing for stupid me any suggestioins, working example to learn from?
  19. Hi everybody fooling around with the MSP432 launchpad. Does anybody know how to properly and elegantly use bit banding? Could not find much on the web and in the examples... This does not work, does not even create an error message: // this does what you expect, a short pulse P1OUT |= BIT0; P1OUT &= ~BIT0; // this does nothing BITBAND_PERI(P1OUT,BIT0)=1; BITBAND_PERI(P1OUT,BIT0)=0; does anybody know what I am doing wrong here?
  20. Hello there I am trying to get the simple example given in Ti Rtos to work. I am using CCS 6.1.0 and TI rtos 2.14.00.10 on a Tiva Connected lauchpad. Installed the Ti-Rtos for Tiva from CCS. Fresh. Windows 8.1 What I get is a compiler error (see below). And it does not build anything. Haven't touched any of the source code of the example files in "PWM Example". anybody any clue? cheers and thanks for any help **** Build of configuration Debug for project pwmled_EK_TM4C1294XL_TI_TivaTM4C1294NCPDT **** "C:\\ti\\ccsv6\\utils\\bin\\gmake" -k all making ../src/sysbios/sysbios.aem4f ... gmake[1]: Entering directory `C:/Users/Roland Manser/Tiva_connected/pwmled_EK_TM4C1294XL_TI_TivaTM4C1294NCPDT/src/sysbios' clem4f C:/ti/tirtos_tivac_2_14_00_10/products/bios_6_42_01_20/packages/ti/sysbios/BIOS.c ... >> ERROR: no source files, nothing to do asmem4f C:/ti/tirtos_tivac_2_14_00_10/products/bios_6_42_01_20/packages/ti/sysbios/family/arm/m3/Hwi_asm.sv7M ... >> ERROR: no source files, nothing to do asmem4f C:/ti/tirtos_tivac_2_14_00_10/products/bios_6_42_01_20/packages/ti/sysbios/family/arm/m3/Hwi_asm_switch.sv7M ... >> ERROR: no source files, nothing to do asmem4f C:/ti/tirtos_tivac_2_14_00_10/products/bios_6_42_01_20/packages/ti/sysbios/family/arm/m3/IntrinsicsSupport_asm.sv7M ... >> ERROR: no source files, nothing to do asmem4f C:/ti/tirtos_tivac_2_14_00_10/products/bios_6_42_01_20/packages/ti/sysbios/family/arm/m3/TaskSupport_asm.sv7M ... >> ERROR: no source files, nothing to do arem4f BIOS.obj m3_Hwi_asm.obj m3_Hwi_asm_switch.obj m3_IntrinsicsSupport_asm.obj m3_TaskSupport_asm.obj ... --> error: 'BIOS.obj' not found --> error: 'm3_Hwi_asm.obj' not found --> error: 'm3_Hwi_asm_switch.obj' not found gmake[1]: Leaving directory `C:/Users/Roland Manser/Tiva_connected/pwmled_EK_TM4C1294XL_TI_TivaTM4C1294NCPDT/src/sysbios' --> error: 'm3_IntrinsicsSupport_asm.obj' not found --> error: 'm3_TaskSupport_asm.obj' not found gmake[1]: *** [sysbios.aem4f] Error 1 gmake[1]: Target `all' not remade because of errors. gmake: *** [../src/sysbios/sysbios.aem4f] Error 2 'Building file: ../EK_TM4C1294XL.c' 'Invoking: ARM Compiler' "C:/ti/ccsv6/tools/compiler/ti-cgt-arm_5.2.4/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 --abi=eabi -me --include_path="C:/ti/ccsv6/tools/compiler/ti-cgt-arm_5.2.4/include" --include_path="C:/Users/Roland Manser/Tiva_connected/pwmled_EK_TM4C1294XL_TI_TivaTM4C1294NCPDT" --include_path="C:/ti/tirtos_tivac_2_14_00_10/products/TivaWare_C_Series-2.1.1.71b" --include_path="C:/ti/tirtos_tivac_2_14_00_10/packages/ti/drivers/wifi/cc3100/Simplelink" --include_path="C:/ti/tirtos_tivac_2_14_00_10/packages/ti/drivers/wifi/cc3100/Simplelink/Include" -g --gcc --define=ccs="ccs" --define=PART_TM4C1294NCPDT --define=ccs --define=TIVAWARE --display_error_number --diag_warning=225 --diag_warning=255 --diag_wrap=off --gen_func_subsections=on --preproc_with_compile --preproc_dependency="EK_TM4C1294XL.pp" --cmd_file="./configPkg/compiler.opt" "../EK_TM4C1294XL.c" "C:/ti/xdctools_3_31_01_33_core/packages/xdc/cfg/global.h", line 39: fatal error #1965: cannot open source file "C:/Users/Roland Manser/Tiva_connected/pwmled_EK_TM4C1294XL_TI_TivaTM4C1294NCPDT/Debug/configPkg/package/cfg/pwmled_pem4f.h" 1 catastrophic error detected in the compilation of "../EK_TM4C1294XL.c". >> Compilation failure Compilation terminated. gmake: *** [EK_TM4C1294XL.obj] Error 1 'Building file: ../pwmled.c' 'Invoking: ARM Compiler' "C:/ti/ccsv6/tools/compiler/ti-cgt-arm_5.2.4/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 --abi=eabi -me --include_path="C:/ti/ccsv6/tools/compiler/ti-cgt-arm_5.2.4/include" --include_path="C:/Users/Roland Manser/Tiva_connected/pwmled_EK_TM4C1294XL_TI_TivaTM4C1294NCPDT" --include_path="C:/ti/tirtos_tivac_2_14_00_10/products/TivaWare_C_Series-2.1.1.71b" --include_path="C:/ti/tirtos_tivac_2_14_00_10/packages/ti/drivers/wifi/cc3100/Simplelink" --include_path="C:/ti/tirtos_tivac_2_14_00_10/packages/ti/drivers/wifi/cc3100/Simplelink/Include" -g --gcc --define=ccs="ccs" --define=PART_TM4C1294NCPDT --define=ccs --define=TIVAWARE --display_error_number --diag_warning=225 --diag_warning=255 --diag_wrap=off --gen_func_subsections=on --preproc_with_compile --preproc_dependency="pwmled.pp" --cmd_file="./configPkg/compiler.opt" "../pwmled.c" "C:/ti/xdctools_3_31_01_33_core/packages/xdc/cfg/global.h", line 39: fatal error #1965: cannot open source file "C:/Users/Roland Manser/Tiva_connected/pwmled_EK_TM4C1294XL_TI_TivaTM4C1294NCPDT/Debug/configPkg/package/cfg/pwmled_pem4f.h" 1 catastrophic error detected in the compilation of "../pwmled.c". >> Compilation failure Compilation terminated. gmake: *** [pwmled.obj] Error 1 'Building file: ../pwmled.cfg' 'Invoking: XDCtools' "C:/ti/xdctools_3_31_01_33_core/xs" --xdcpath="C:/ti/tirtos_tivac_2_14_00_10/packages;C:/ti/tirtos_tivac_2_14_00_10/products/bios_6_42_01_20/packages;C:/ti/tirtos_tivac_2_14_00_10/products/ndk_2_24_03_35/packages;C:/ti/tirtos_tivac_2_14_00_10/products/uia_2_00_02_39/packages;C:/ti/ccsv6/ccs_base;" xdc.tools.configuro -o configPkg -t ti.targets.arm.elf.M4F -p ti.platforms.tiva:TM4C1294NCPDT -r release -c "C:/ti/ccsv6/tools/compiler/ti-cgt-arm_5.2.4" --compileOptions "-mv7M4 --code_state=16 --float_support=FPv4SPD16 --abi=eabi -me --include_path=\"C:/ti/ccsv6/tools/compiler/ti-cgt-arm_5.2.4/include\" --include_path=\"C:/Users/Roland Manser/Tiva_connected/pwmled_EK_TM4C1294XL_TI_TivaTM4C1294NCPDT\" --include_path=\"C:/ti/tirtos_tivac_2_14_00_10/products/TivaWare_C_Series-2.1.1.71b\" --include_path=\"C:/ti/tirtos_tivac_2_14_00_10/packages/ti/drivers/wifi/cc3100/Simplelink\" --include_path=\"C:/ti/tirtos_tivac_2_14_00_10/packages/ti/drivers/wifi/cc3100/Simplelink/Include\" -g --gcc --define=ccs=\"ccs\" --define=PART_TM4C1294NCPDT --define=ccs --define=TIVAWARE --display_error_number --diag_warning=225 --diag_warning=255 --diag_wrap=off --gen_func_subsections=on " "../pwmled.cfg" configuring pwmled.xem4f from package/cfg/pwmled_pem4f.cfg ... generating custom ti.sysbios library makefile ... Starting build of library sources ... making C:/Users/ROLAND~1/Tiva_connected/pwmled_EK_TM4C1294XL_TI_TivaTM4C1294NCPDT/src/sysbios/sysbios.aem4f ... gmake[1]: Entering directory `C:/Users/ROLAND~1/Tiva_connected/pwmled_EK_TM4C1294XL_TI_TivaTM4C1294NCPDT/src/sysbios' clem4f C:/ti/tirtos_tivac_2_14_00_10/products/bios_6_42_01_20/packages/ti/sysbios/BIOS.c ... C:/Users/ROLAND~1/AppData/Local/Temp/make21736-1.sh: 1: Syntax error: Unterminated quoted string gmake[1]: *** [bIOS.obj] Error 2 gmake[1]: Leaving directory `C:/Users/ROLAND~1/Tiva_connected/pwmled_EK_TM4C1294XL_TI_TivaTM4C1294NCPDT/src/sysbios' gmake: *** [C:/Users/ROLAND~1/Tiva_connected/pwmled_EK_TM4C1294XL_TI_TivaTM4C1294NCPDT/src/sysbios/sysbios.aem4f] Error 2 Build of libraries failed. error: xdc.cfg.SourceDir: "C:/ti/xdctools_3_31_01_33_core/packages/xdc/cfg/SourceDir.xs", line 209: xdc.cfg.SourceDir : Build of generated source libraries failed: exit status = 2: js: "C:/ti/xdctools_3_31_01_33_core/packages/xdc/cfg/Main.xs", line 160: Error: Configuration failed! xdctools_3_31_01_33_core\gmake.exe: *** [package/cfg/pwmled_pem4f.xdl] Error 1 xdctools_3_31_01_33_core\gmake.exe: *** Deleting file `package/cfg/pwmled_pem4f.xdl' xdctools_3_31_01_33_core\gmake.exe: *** [package/cfg/pwmled_pem4f.xdl] Deleting file `package/cfg/pwmled_pem4f.h' xdctools_3_31_01_33_core\gmake.exe: *** [package/cfg/pwmled_pem4f.xdl] Deleting file `package/cfg/pwmled_pem4f.c' js: "C:/ti/xdctools_3_31_01_33_core/packages/xdc/tools/Cmdr.xs", line 51: Error: xdc.tools.configuro: configuration failed due to earlier errors (status = 2); 'linker.cmd' deleted. gmake: *** [configPkg/linker.cmd] Error 1 gmake: Target `all' not remade because of errors. **** Build Finished ****
  21. Problem solved, thanks, tripwire The space in the path was the culprit. Nice little trap that is.... The space wasn't even mine, it was created by Windows....
  22. you might get a lower power solution if you power the whole MSP430 from a regulator and forget about the internal reference. No, not a 7805, rather something like a MCP1700. Draws only 1.6uA. Regulators are not as bad as they used to be.
  23. Thanks RobG! Of course this works now. Stupid me. Strange though, performance wise, this bitbanding does not seem to help any thing, this code, built around the example msp432p401_cs_03, "configuration for 48Mhz". volatile uint32_t i; P1DIR |= BIT0; while (1) { P1OUT |= BIT0; P1OUT &= ~BIT0; BITBAND_PERI(P1OUT,0)=1; BITBAND_PERI(P1OUT,0)=0; for(i=0;i<2;i++); } results in this signal: - first pulse exactly the same time as second one - much slower than I expected: 330nS per pulse, that is 16 clock cycles - yes, the device runs at 48Mhz, checked at P4.3 and measured around 7.5mA supply current
  24. Connected one of those http://www.newhavendisplay.com/lcd-chiponglass-128-x-32-c-3_113.html to the launchpad. These are really tiny chip-on-glass LCD displays. The visible area is 8 x 32mm. More tricky than the software is the hardware: in order to work, I had to connect nine 1uF ceramic caps to the display (I guess that with the chip-on-glass display it is not possible to integrate the caps into he display). Made a small,hand etched, one sided PCB, to accomodate the caps and to change from the weird 1.5mm connector pitch to a 2.54 one. 6502 for size comparison only ;-) RobG's Nokia software helped me to get the hardware SPI right. Software-SPI, works as well, advantage is the free choice of the pins, but more processor time is wasted for the display. I measured 85uA, with the example clock program (Display + MSP in LPM3), without backlight. So power-wise this fits perfectly with the MSP. Official working voltage is 2.7-3.3V. The 3.6V of the LP are the maximum rating for the display. The backlight is already bright enough for me with 2mA. So switching the backlight on/offwith an extra pin would be easy. #include "msp430g2553.h" const unsigned char font5x8[][5] ={ { 0x00, 0x00, 0x00, 0x00, 0x00 }, // sp { 0x00, 0x00, 0x2f, 0x00, 0x00 }, // ! { 0x00, 0x07, 0x00, 0x07, 0x00 }, // " { 0x14, 0x7f, 0x14, 0x7f, 0x14 }, // # { 0x24, 0x2a, 0x7f, 0x2a, 0x12 }, // $ { 0x62, 0x64, 0x08, 0x13, 0x23 }, // % { 0x36, 0x49, 0x55, 0x22, 0x50 }, // & { 0x00, 0x05, 0x03, 0x00, 0x00 }, // ' { 0x00, 0x1c, 0x22, 0x41, 0x00 }, // ( { 0x00, 0x41, 0x22, 0x1c, 0x00 }, // ) { 0x14, 0x08, 0x3E, 0x08, 0x14 }, // * { 0x08, 0x08, 0x3E, 0x08, 0x08 }, // + { 0x00, 0x00, 0x50, 0x30, 0x00 }, // , { 0x08, 0x08, 0x08, 0x08, 0x08 }, // - { 0x00, 0x60, 0x60, 0x00, 0x00 }, // . { 0x20, 0x10, 0x08, 0x04, 0x02 }, // / { 0x3E, 0x51, 0x49, 0x45, 0x3E }, // 0 { 0x00, 0x42, 0x7F, 0x40, 0x00 }, // 1 { 0x42, 0x61, 0x51, 0x49, 0x46 }, // 2 { 0x21, 0x41, 0x45, 0x4B, 0x31 }, // 3 { 0x18, 0x14, 0x12, 0x7F, 0x10 }, // 4 { 0x27, 0x45, 0x45, 0x45, 0x39 }, // 5 { 0x3C, 0x4A, 0x49, 0x49, 0x30 }, // 6 { 0x01, 0x71, 0x09, 0x05, 0x03 }, // 7 { 0x36, 0x49, 0x49, 0x49, 0x36 }, // 8 { 0x06, 0x49, 0x49, 0x29, 0x1E }, // 9 { 0x00, 0x36, 0x36, 0x00, 0x00 }, // : { 0x00, 0x56, 0x36, 0x00, 0x00 }, // ; { 0x08, 0x14, 0x22, 0x41, 0x00 }, // < { 0x14, 0x14, 0x14, 0x14, 0x14 }, // = { 0x00, 0x41, 0x22, 0x14, 0x08 }, // > { 0x02, 0x01, 0x51, 0x09, 0x06 }, // ? { 0x32, 0x49, 0x59, 0x51, 0x3E }, // @ { 0x7C, 0x12, 0x11, 0x12, 0x7C }, // A { 0x7F, 0x49, 0x49, 0x49, 0x36 }, // B { 0x3E, 0x41, 0x41, 0x41, 0x22 }, // C { 0x7F, 0x41, 0x41, 0x22, 0x1C }, // D { 0x7F, 0x49, 0x49, 0x49, 0x41 }, // E { 0x7F, 0x09, 0x09, 0x09, 0x01 }, // F { 0x3E, 0x41, 0x49, 0x49, 0x7A }, // G { 0x7F, 0x08, 0x08, 0x08, 0x7F }, // H { 0x00, 0x41, 0x7F, 0x41, 0x00 }, // I { 0x20, 0x40, 0x41, 0x3F, 0x01 }, // J { 0x7F, 0x08, 0x14, 0x22, 0x41 }, // K { 0x7F, 0x40, 0x40, 0x40, 0x40 }, // L { 0x7F, 0x02, 0x0C, 0x02, 0x7F }, // M { 0x7F, 0x04, 0x08, 0x10, 0x7F }, // N { 0x3E, 0x41, 0x41, 0x41, 0x3E }, // O { 0x7F, 0x09, 0x09, 0x09, 0x06 }, // P { 0x3E, 0x41, 0x51, 0x21, 0x5E }, // Q { 0x7F, 0x09, 0x19, 0x29, 0x46 }, // R { 0x46, 0x49, 0x49, 0x49, 0x31 }, // S { 0x01, 0x01, 0x7F, 0x01, 0x01 }, // T { 0x3F, 0x40, 0x40, 0x40, 0x3F }, // U { 0x1F, 0x20, 0x40, 0x20, 0x1F }, // V { 0x3F, 0x40, 0x38, 0x40, 0x3F }, // W { 0x63, 0x14, 0x08, 0x14, 0x63 }, // X { 0x07, 0x08, 0x70, 0x08, 0x07 }, // Y { 0x61, 0x51, 0x49, 0x45, 0x43 }, // Z { 0x00, 0x7F, 0x41, 0x41, 0x00 }, // [ { 0x04, 0x08, 0x10, 0x20, 0x40 }, // / { 0x00, 0x41, 0x41, 0x7F, 0x00 }, // ] { 0x04, 0x02, 0x01, 0x02, 0x04 }, // ^ { 0x40, 0x40, 0x40, 0x40, 0x40 }, // _ { 0x00, 0x01, 0x02, 0x04, 0x00 }, // ' { 0x20, 0x54, 0x54, 0x54, 0x78 }, // a { 0x7F, 0x48, 0x44, 0x44, 0x38 }, // b { 0x38, 0x44, 0x44, 0x44, 0x20 }, // c { 0x38, 0x44, 0x44, 0x48, 0x7F }, // d { 0x38, 0x54, 0x54, 0x54, 0x18 }, // e { 0x08, 0x7E, 0x09, 0x01, 0x02 }, // f { 0x18, 0xA4, 0xA4, 0xA4, 0x7C }, // g { 0x7F, 0x08, 0x04, 0x04, 0x78 }, // h { 0x00, 0x44, 0x7D, 0x40, 0x00 }, // i { 0x40, 0x80, 0x84, 0x7D, 0x00 }, // j { 0x7F, 0x10, 0x28, 0x44, 0x00 }, // k { 0x00, 0x41, 0x7F, 0x40, 0x00 }, // l { 0x7C, 0x04, 0x18, 0x04, 0x78 }, // m { 0x7C, 0x08, 0x04, 0x04, 0x78 }, // n { 0x38, 0x44, 0x44, 0x44, 0x38 }, // o { 0xFC, 0x24, 0x24, 0x24, 0x18 }, // p { 0x18, 0x24, 0x24, 0x18, 0xFC }, // q { 0x7C, 0x08, 0x04, 0x04, 0x08 }, // r { 0x48, 0x54, 0x54, 0x54, 0x20 }, // s { 0x04, 0x3F, 0x44, 0x40, 0x20 }, // t { 0x3C, 0x40, 0x40, 0x20, 0x7C }, // u { 0x1C, 0x20, 0x40, 0x20, 0x1C }, // v { 0x3C, 0x40, 0x30, 0x40, 0x3C }, // w { 0x44, 0x28, 0x10, 0x28, 0x44 }, // x { 0x1C, 0xA0, 0xA0, 0xA0, 0x7C }, // y { 0x44, 0x64, 0x54, 0x4C, 0x44 }, // z { 0x08, 0x36, 0x41, 0x41, 0x00 }, // { { 0x00, 0x00, 0x7F, 0x00, 0x00 }, // | { 0x41, 0x41, 0x36, 0x08, 0x00 }, // } { 0x02, 0x04, 0x02, 0x01, 0x02 } // ~ }; unsigned char hour=12, min, sec,j; void clearline(unsigned char); void clearall(void); void print( char* s); void gotoXy(unsigned char , unsigned char); void printc(unsigned char r); void sendData(unsigned char data); void sendCmd(unsigned char cmd); //lcd connected to port 0 #define A0 BIT2 #define CS BIT3 #define SCK BIT5 #define SDA BIT7 #define RST BIT6 void main(void) { WDTCTL = WDT_ADLY_1000; // WDT 1sec, ACLK, interval timer IE1 |= WDTIE; // Enable WDT interrupt BCSCTL1 = CALBC1_1MHZ; DCOCTL = CALDCO_1MHZ; P1DIR = 0b11101100; P1REN = 0b00010011; P2REN = 0b00111111; P1SEL |=SCK + SDA; P1SEL2|=SCK + SDA; UCB0CTL0 |= UCCKPH + UCMSB + UCMST + UCSYNC; // 3-pin, 8-bit SPI master UCB0CTL1 |= UCSSEL_2; // SMCLK UCB0BR0 |= 0x01; // 1:1 UCB0BR1 = 0; UCB0CTL1 &= ~UCSWRST; // clear SW P1OUT &= ~RST; __delay_cycles(1000); P1OUT |= RST; P1OUT &=~A0; P1OUT &=~CS; //Initialize LCD display //see http://www.newhavendisplay.com/specs/NHD-C12832A1Z-FSRGB-FBW-3V.pdf for command set sendCmd(0xA1); //ADC select reverse mode sendCmd(0xA2); // 1/7 bias sendCmd(0x2F); //VC on, VR on, VF on sendCmd(0x21); //resistor ratio 3.5 sendCmd(0x81); //set contrast sendCmd(0x27); //adjust this number to get the best contrast sendCmd(0xAF); //now turn it on! clearall(); gotoXy(0,20); print("MSP430G2553 LCD"); gotoXy(1,35); print("2015-05-22"); while (1){ sec++; if (sec==60){ sec=0; clearline(2); min++; if (min==60){ min=0; hour++; if (hour==24) hour=0; } } gotoXy(3,40); printc((hour/10%10)+48); printc((hour%10)+48); printc(':'); printc((min/10%10)+48); printc((min%10)+48); printc(':'); printc((sec/10%10)+48); printc((sec%10)+48); gotoXy(2,sec); print("Hello World!"); __bis_SR_register(LPM3_bits + GIE); // Enter LPM3 w/interrupt } } // Watchdog Timer interrupt service routine #pragma vector=WDT_VECTOR __interrupt void watchdog_timer(void){ __bic_SR_register_on_exit(CPUOFF); // wake up } void clearall(void){ unsigned char i; for(i = 0; i<4 ; i++) clearline(i); } void clearline(unsigned char line){ unsigned char j; sendCmd(0xB0 | line); //sets page(row) sendCmd(0x10); //sets column address(MSB) to 0 for each page(row) sendCmd(0x04); //sets Column address(LSB) start, for this display 4 for(j=0;j<128;j++) {sendData(0x00);} } void sendData(unsigned char data){ P1OUT |=A0; UCB0TXBUF = data; while(!(IFG2 & UCB0TXIFG)); } void sendCmd(unsigned char cmd){ P1OUT &=~A0; UCB0TXBUF = cmd; while(!(IFG2 & UCB0TXIFG)); } void gotoXy(unsigned char x,unsigned char y){ y+=4; //this display does not show first four lines sendCmd(0xB0|(x & 0x03)); sendCmd(0x10|((y>>4))); sendCmd(0x00|(y & 0x0F)); } void print(char* s){ while(*s) printc(*s++); } void printc(unsigned char r){ unsigned char i; sendData(0); for (i=0;i<5;i++) sendData(font5x8[r-32][i] ); }
  25. Hi, Did anybody here connect the LP, G2553 to one of these displays? http://www.digikey.com/product-search/en?x=14&y=11〈=en&site=us&keywords=NHD-C12832A1Z-FSW-FBW-3V3-ND Controller is ST7565, I guess this one is quite a bit different from the "nokia 5110" controller? Stuff I found on the web so far was mostly arduino or pic, nothing on the MSP: http://www.ladyada.net/learn/lcd/st7565.html Nice thing would be that voltage-wise these displays would fit perfectly, no worries with 5V/3.3V. any suggestions?