Jump to content

gcb

Members
  • Content Count

    16
  • Joined

  • Last visited

About gcb

  • Rank
    Member

Profile Information

  • Sparkfun
    i get all my wishes from china.
  1. sure, did that one the other thread... viewtopic.php?f=38&t=3370 olivluca sent me to the wiki page with the linux driver fix (afraid to call that a fix since it will give problems for other use cases down the road, but hey, i get data and i couldn't do better anyway maybe need to link that wiki page from the main serial page? i thought i had gone trhu all wiki pages until olivluca sent me that link. I think that a generic example on how to probe A10 would sufice for me to understand it. The page you link to is pretty much my new wallpaper but it does not mention anything about threating analogs reads differently than pins. Since in arduino it's not so different i thought it would apply here in Energia as well. Also, that wiki page: - mentions GREEN_LED; PUSH2; TEMPSENSOR; as all the same. - has no analogRead examples. I can't say i know the intended Energia way to use analogRead...
  2. I did a quick look on wiring_analog.c and can't see anything obvious why analogRead on the temp sensor shouldn't work. it even seems to prefer the settings for the internal temp sensor...
  3. in pins_energia.h A10 and P2_2 equal 10. Does that means analogRead is definitely not the way to read the temp sensor? /* attach leds and resistors on pins 1.0 , 1.3 to 2.1 */ // heart beat int ledState = LOW; long previousMillis = 0; // the follow variables is a long because the time, measured in miliseconds, // will quickly become a bigger number than can be stored in an int. long interval = 1000; // interval at which to blink (milliseconds) void setup() { // set the digital pin as output: pinMode(GREEN_LED, OUTPUT); // green led for heart beat // segment leds pinMode(P1_0, OUTPUT); pinMode(P1_3, OUTPUT); pinMode(P1_4, OUTPUT); pinMode(P1_5, OUTPUT); pinMode(P2_0, OUTPUT); pinMode(P2_1, OUTPUT); // test the lights light(0, 1000); // 0 delay(300); light(1, 1000); // 1 delay(300); light(167, 1000); // 2 delay(300); light(334, 1000); // 3 delay(300); light(501, 1000); // 4 delay(300); light(667, 1000); // 5 delay(300); light(834, 1000); // 6 delay(300); // now blink three times and lights out. light(0, 1000); delay(300); light(834, 1000); delay(300); light(0, 1000); delay(300); light(834, 1000); delay(300); light(0, 1000); delay(300); light(834, 1000); delay(300); light(0, 1000); delay(300); // start internal temp sensor ADC10CTL0 = SREF_1 + ADC10SHT_3 + REFON + ADC10ON; ADC10CTL1 = INCH_10 + ADC10DIV_3; // Channel 10 = Tem // open serial line Serial.begin(9600); } int x; void loop(){ // heartbeat unsigned long currentMillis = millis(); if(currentMillis - previousMillis > interval) { previousMillis = currentMillis;// save the last time you blinked the LED ledState = !ledState; digitalWrite(GREEN_LED, ledState); // x = analogRead(A10); ADC10CTL0 |= ENC + ADC10SC; while (!(ADC10CTL0 & ADC10IFG)) /* wait until conversion is completed */ ; unsigned adc = ADC10MEM; // shut off conversion and lower flag to save power. // ADC10SC is reset automatically. while (ADC10CTL0 & ADC10BUSY) /* wait for non-busy per section 22.2.6.6 in User's Guide */ ; ADC10CTL0 &= ~ENC; ADC10CTL0 &= ~ADC10IFG; // ADC to C degrees unsigned c = (adc * 27069L - 18169625L) >> 16; light(c, 80); // light leds in a scale of 0C to 80C Serial.println(c); } } void light( int val, int ceiling ){ int increments = ceiling/6; if( val > (increments*5) ){ digitalWrite(P1_0, HIGH); digitalWrite(P1_3, HIGH); digitalWrite(P1_4, HIGH); digitalWrite(P1_5, HIGH); digitalWrite(P2_0, HIGH); digitalWrite(P2_1, HIGH); }else if( val > (increments*4) ){ digitalWrite(P1_0, HIGH); digitalWrite(P1_3, HIGH); digitalWrite(P1_4, HIGH); digitalWrite(P1_5, HIGH); digitalWrite(P2_0, HIGH); digitalWrite(P2_1, LOW); }else if( val > (increments*3) ){ digitalWrite(P1_0, HIGH); digitalWrite(P1_3, HIGH); digitalWrite(P1_4, HIGH); digitalWrite(P1_5, HIGH); digitalWrite(P2_0, LOW); digitalWrite(P2_1, LOW); }else if( val > (increments*2) ){ digitalWrite(P1_0, HIGH); digitalWrite(P1_3, HIGH); digitalWrite(P1_4, HIGH); digitalWrite(P1_5, LOW); digitalWrite(P2_0, LOW); digitalWrite(P2_1, LOW); }else if( val > increments ){ digitalWrite(P1_0, HIGH); digitalWrite(P1_3, HIGH); digitalWrite(P1_4, LOW); digitalWrite(P1_5, LOW); digitalWrite(P2_0, LOW); digitalWrite(P2_1, LOW); }else if( val > 0 ){ digitalWrite(P1_0, HIGH); digitalWrite(P1_3, LOW); digitalWrite(P1_4, LOW); digitalWrite(P1_5, LOW); digitalWrite(P2_0, LOW); digitalWrite(P2_1, LOW); }else{ digitalWrite(P1_0, LOW); digitalWrite(P1_3, LOW); digitalWrite(P1_4, LOW); digitalWrite(P1_5, LOW); digitalWrite(P2_0, LOW); digitalWrite(P2_1, LOW); } } most temp sensor code from here http://www.cashdollar.org/2012/07/26/si ... onversion/
  4. Now that i got serial to work (linux driver issue), i had to move those led pins around... now they are on P1_0 and then P1_3 to P2_1 but still, now i have: x = analogRead(A10); light(x, 120); Serial.println(x); as soon as i run the 1st line here, LED connected to 1.3 goes dark (or dimmed... can't really tell as i'm using a 10segment display and there's some light bleeding from the others) serial is working fine, even though the code before having serial dimmed the leds on TX,RX, now it seems to have no effect on serial communications. on the serial line i keep getting a number around 327, that slowly climbs to 333 and stays there. or climbs rapidly if i reset it instead of leaving it offline for some time.
  5. gcb

    [solved] no serial communication

    also, using PIN 1.1 and 1.2 was jamming the data on my other test... i though it was required only for software serial... but if I have a led there as soon as i start the serial code i get led on 1.2 lit.
  6. gcb

    [solved] no serial communication

    hum... it didn't showed up on the wiki before ... ah, i was looking at home, not "Pages" let me try this. thanks. update: took some time to build the module... the zip file had a all files with DOS termination and i was getting errors in the build logs such as: "directory /perfectly/valid/dir do not exist" only to find out the ^M at the end of the path didn't show up in the logs as well :? after converting to unix ( vim file -c "set ff=unix" -c "wq" ) install.sh, Makefile, *.c, *.conf it worked. My new dmesg: [26834.944045] usb 3-1: new full-speed USB device number 17 using uhci_hcd [26835.147078] usb 3-1: New USB device found, idVendor=0451, idProduct=f432 [26835.147084] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [26835.147088] usb 3-1: Product: Texas Instruments MSP-FET430UIF [26835.147091] usb 3-1: Manufacturer: Texas Instruments [26835.147094] usb 3-1: SerialNumber: AAFF426C50060E3A [26835.157145] cdc_acm 3-1:1.0: This device cannot do calls on its own. It is not a modem. [26835.157152] cdc_acm 3-1:1.0: No union descriptor, testing for castrated device [26835.157184] cdc_acm 3-1:1.0: ttyACM0: USB ACM device [26845.209080] generic-usb 0003:0451:F432.000F: usb_submit_urb(ctrl) failed [26845.209095] generic-usb 0003:0451:F432.000F: timeout initializing reports [26845.209994] generic-usb 0003:0451:F432.000F: hiddev0,hidraw1: USB HID v1.01 Device [Texas Instruments Texas Instruments MSP-FET430UIF] on usb-0000:00:1d.2-1/input1 Update: now i do get data! thanks. (at first thought not because was using tail -f but it was set for another baud, after setting to the right one i got my "A"s filling the screen)
  7. gcb

    [solved] no serial communication

    nothing too complex. just used two female jumper cables.
  8. Since I'm having trouble getting my serial to work, i'm thinking of other ways to probe the values from a sensor i have... so i attached a few leds to P1_0 to P1_5 and light them up based on the values i'm getting so i can probe around and find the range the sensor work. before i hook up the sensor i tried to test it out with the internal temperature sensor and found this oddity... it may very well be something extremely dumb with my code... /* attach leds and resistors on pins 1.0 to 1.5 */ // heart beat int ledState = LOW; long previousMillis = 0; // the follow variables is a long because the time, measured in miliseconds, // will quickly become a bigger number than can be stored in an int. long interval = 1000; // interval at which to blink (milliseconds) void setup() { // set the digital pin as output: pinMode(GREEN_LED, OUTPUT); // green led for heart beat // segment leds pinMode(P1_0, OUTPUT); pinMode(P1_1, OUTPUT); pinMode(P1_2, OUTPUT); pinMode(P1_3, OUTPUT); pinMode(P1_4, OUTPUT); pinMode(P1_5, OUTPUT); // input for sensor pinMode(P2_6, INPUT); // internal thermometer //pinMode(A10, INPUT); //need to initialize? // test the lights light(0, 1000); // 0 delay(300); light(1, 1000); // 1 delay(300); light(167, 1000); // 2 delay(300); light(334, 1000); // 3 delay(300); light(501, 1000); // 4 delay(300); light(667, 1000); // 5 delay(300); light(834, 1000); // 6 delay(300); // now blink three times and lights out. light(0, 1000); delay(300); light(834, 1000); delay(300); light(0, 1000); delay(300); light(834, 1000); delay(300); light(0, 1000); delay(300); light(834, 1000); delay(300); light(0, 1000); delay(300); } int x; void loop(){ x = analogRead(A10); light(x, 120); //x = analogRead(P2_6); // heartbeat unsigned long currentMillis = millis(); if(currentMillis - previousMillis > interval) { previousMillis = currentMillis;// save the last time you blinked the LED ledState = !ledState; digitalWrite(GREEN_LED, ledState); } } void light( int val, int ceiling ){ int increments = ceiling/6; if( val > (increments*5) ){ digitalWrite(P1_0, HIGH); digitalWrite(P1_1, HIGH); digitalWrite(P1_2, HIGH); digitalWrite(P1_3, HIGH); digitalWrite(P1_4, HIGH); digitalWrite(P1_5, HIGH); }else if( val > (increments*4) ){ digitalWrite(P1_0, HIGH); digitalWrite(P1_1, HIGH); digitalWrite(P1_2, HIGH); digitalWrite(P1_3, HIGH); digitalWrite(P1_4, HIGH); digitalWrite(P1_5, LOW); }else if( val > (increments*3) ){ digitalWrite(P1_0, HIGH); digitalWrite(P1_1, HIGH); digitalWrite(P1_2, HIGH); digitalWrite(P1_3, HIGH); digitalWrite(P1_4, LOW); digitalWrite(P1_5, LOW); }else if( val > (increments*2) ){ digitalWrite(P1_0, HIGH); digitalWrite(P1_1, HIGH); digitalWrite(P1_2, HIGH); digitalWrite(P1_3, LOW); digitalWrite(P1_4, LOW); digitalWrite(P1_5, LOW); }else if( val > increments ){ digitalWrite(P1_0, HIGH); digitalWrite(P1_1, HIGH); digitalWrite(P1_2, LOW); digitalWrite(P1_3, LOW); digitalWrite(P1_4, LOW); digitalWrite(P1_5, LOW); }else if( val > 0 ){ digitalWrite(P1_0, HIGH); digitalWrite(P1_1, LOW); digitalWrite(P1_2, LOW); digitalWrite(P1_3, LOW); digitalWrite(P1_4, LOW); digitalWrite(P1_5, LOW); }else{ digitalWrite(P1_0, LOW); digitalWrite(P1_1, LOW); digitalWrite(P1_2, LOW); digitalWrite(P1_3, LOW); digitalWrite(P1_4, LOW); digitalWrite(P1_5, LOW); } } it have the following features: - green led will blink every 1s to show it's still alive. - at power up, 6leds will light up one at a time, and then flash 3x. (mostly to unit test my code) - after that, will analogRead(A10) every cycle and every second update the leds. what i expect this does, is to every second to light up the leds based on the temperature. what happens... - green led blinks away every second just fine - at power up they light up as expected. - leds on P1_0, P1_2, P1_4, P1_5 stays ON at all times - leds on P1_1, P1_3 stays OFF at all times. any ideas? update: tried to move the update probe to the heartbeat condition (and same thing still happens), so this rule out that the analogRead(A10) is setting the pins on HIGH as i was thinking... update2: if I simply remove the code in my light() function, when analogRead(A10) happens i can see the led in P1_1 almost lighted on... (i'm using a 220Ohm on all leds, they are 20mA, ~2Vf) I see that same dimmed light on the leds when i press RESET (on P1_1 and P1_2)
  9. gcb

    [solved] no serial communication

    tried all the ways... with it in parallel (as the board comes) with it crossed, with the pins opens still nothing... I do get different kernel messages depending on how i plug it: dmesg with pins in parallel Oct 14 11:54:10 hobo kernel: [ 4924.852052] usb 3-1: new full-speed USB device number 8 using uhci_hcd Oct 14 11:54:10 hobo kernel: [ 4925.056066] usb 3-1: New USB device found, idVendor=0451, idProduct=f432 Oct 14 11:54:10 hobo kernel: [ 4925.056072] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 Oct 14 11:54:10 hobo kernel: [ 4925.056075] usb 3-1: Product: Texas Instruments MSP-FET430UIF Oct 14 11:54:10 hobo kernel: [ 4925.056078] usb 3-1: Manufacturer: Texas Instruments Oct 14 11:54:10 hobo kernel: [ 4925.056081] usb 3-1: SerialNumber: AAFF426C50060E3A Oct 14 11:54:10 hobo kernel: [ 4925.066116] cdc_acm 3-1:1.0: No union descriptor, testing for castrated device Oct 14 11:54:10 hobo kernel: [ 4925.066143] cdc_acm 3-1:1.0: ttyACM0: USB ACM device Oct 14 11:54:20 hobo kernel: [ 4935.118079] generic-usb 0003:0451:F432.0008: timeout initializing reports Oct 14 11:54:20 hobo kernel: [ 4935.119098] generic-usb 0003:0451:F432.0008: hiddev0,hidraw1: USB HID v1.01 Device [Texas Instruments Texas Instruments MSP-FET430UIF] on usb-0000:00:1d.2-1/input1 Oct 14 11:54:20 hobo mtp-probe: checking bus 3, device 8: "/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1" Oct 14 11:54:20 hobo mtp-probe: bus: 3, device: 8 was not an MTP device Oct 14 11:58:24 hobo kernel: [ 5178.656070] usb 3-1: USB disconnect, device number 8 with rx/tx crossed Oct 14 11:59:31 hobo kernel: [ 5245.952047] usb 3-1: new full-speed USB device number 9 using uhci_hcd Oct 14 11:59:31 hobo kernel: [ 5246.155071] usb 3-1: New USB device found, idVendor=0451, idProduct=f432 Oct 14 11:59:31 hobo kernel: [ 5246.155077] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 Oct 14 11:59:31 hobo kernel: [ 5246.155081] usb 3-1: Product: Texas Instruments MSP-FET430UIF Oct 14 11:59:31 hobo kernel: [ 5246.155085] usb 3-1: Manufacturer: Texas Instruments Oct 14 11:59:31 hobo kernel: [ 5246.155088] usb 3-1: SerialNumber: AAFF426C50060E3A Oct 14 11:59:31 hobo kernel: [ 5246.165118] cdc_acm 3-1:1.0: No union descriptor, testing for castrated device Oct 14 11:59:31 hobo kernel: [ 5246.165144] cdc_acm 3-1:1.0: ttyACM0: USB ACM device Oct 14 12:00:16 hobo kernel: [ 5291.169097] generic-usb: probe of 0003:0451:F432.0009 failed with error -110 Oct 14 12:00:16 hobo mtp-probe: checking bus 3, device 9: "/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1" Oct 14 12:00:17 hobo mtp-probe: bus: 3, device: 9 was not an MTP device Oct 14 12:00:50 hobo kernel: [ 5324.976078] usb 3-1: USB disconnect, device number 9 with the pins crossed sometimes the serial port mentioned by the kernel does not show up on the energia list. and minicom gives me "cannot open /dev/ttyACM0: Input/output error" Also, i'm assuming this would all work via the USB interface right? on both those pages there's no info about extra pins to be used.
  10. I can never get any serial output on the serial window. i'm building from source. currently from d5632bb6a844dd59c57029ec7a56d890db80201b (also, my window says "Energia ${version}" so there's may be something wrong with the way i'm building... i.e. just typing `ant`) i'm using a rev1.4 board with a G2553, nothing else attached. also tried using minicom to listen on port /dev/ttyS0 to S3 and ttyACM0 with 8N1 9600, same silence. lsusb Bus 003 Device 003: ID 0451:f432 Texas Instruments, Inc. eZ430 Development Tool Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 1.10 bDeviceClass 0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 8 idVendor 0x0451 Texas Instruments, Inc. idProduct 0xf432 eZ430 Development Tool bcdDevice 1.00 iManufacturer 1 Texas Instruments iProduct 2 Texas Instruments MSP-FET430UIF iSerial 3 AAFF426C50060E3A bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 85 bNumInterfaces 2 bConfigurationValue 1 iConfiguration 0 bmAttributes 0x80 (Bus Powered) MaxPower 100mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 3 bInterfaceClass 2 Communications bInterfaceSubClass 2 Abstract (modem) bInterfaceProtocol 1 AT-commands (v.25ter) iInterface 5 MSP430 Application UART CDC Header: bcdCDC 1.10 CDC Call Management: bmCapabilities 0x00 bDataInterface 0 CDC ACM: bmCapabilities 0x02 line coding and serial state Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x82 EP 2 IN bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 255 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x03 EP 3 OUT bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 255 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x83 EP 3 IN bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 255 Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 1 bAlternateSetting 0 bNumEndpoints 2 bInterfaceClass 3 Human Interface Device bInterfaceSubClass 0 No Subclass bInterfaceProtocol 0 None iInterface 4 MSP430 Debug-Interface HID Device Descriptor: bLength 9 bDescriptorType 33 bcdHID 1.01 bCountryCode 0 Not supported bNumDescriptors 1 bDescriptorType 34 Report wDescriptorLength 694 Report Descriptors: ** UNAVAILABLE ** Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 1 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x01 EP 1 OUT bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 1 Device Status: 0x0000 (Bus Powered) dmesg: [ 526.216039] usb 3-1: new full-speed USB device number 3 using uhci_hcd [ 526.417105] usb 3-1: New USB device found, idVendor=0451, idProduct=f432 [ 526.417111] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 526.417115] usb 3-1: Product: Texas Instruments MSP-FET430UIF [ 526.417118] usb 3-1: Manufacturer: Texas Instruments [ 526.417121] usb 3-1: SerialNumber: AAFF426C50060E3A [ 526.426137] cdc_acm 3-1:1.0: This device cannot do calls on its own. It is not a modem. [ 526.426145] cdc_acm 3-1:1.0: No union descriptor, testing for castrated device [ 526.426175] cdc_acm 3-1:1.0: ttyACM0: USB ACM device [ 536.477073] generic-usb 0003:0451:F432.0003: usb_submit_urb(ctrl) failed [ 536.477088] generic-usb 0003:0451:F432.0003: timeout initializing reports [ 536.478095] generic-usb 0003:0451:F432.0003: hiddev0,hidraw1: USB HID v1.01 Device [Texas Instruments Texas Instruments MSP-FET430UIF] on usb-0000:00:1d.2-1/input1
  11. gcb

    trying to grasp clocks

    I'm trying to make the launchpad talk serial at 57600 or 19200 baud. i tried reading slaa322b, but it mostly passed over my head and the only think i learned from it is that everything will go wrong if i use a crystal... but let's go... first thing i noticed is that even 19200 is more than half the 32760. Can i hope to do anything useful at 0.589x my max clock? I'm still unsure how the clock relates to the cpu instruction cycle... i gathered there's the cpu bound clock at 32khz, and an optional peripheral clock that can go up to 100mhz... but i think those other clocks are moot for me since i'm caring about code in the cpu anyway... i'm coming from platforms that run at full power and the cpu clock is king. this is really weird for me... i'm not even understanding if my G2231 has a 32khz clock or if it's the one i have to solder on the board. If it's the one i have to solder i think my fun with the msp430 will end here because i will not do that. (well, i will try, and destroy both component and the board in the process. that's what i mean by i will not do it. and before you try to say it's easy, keep in mind i can't solder speaker wires correctly)
  12. gcb

    New Stellaris Launchpad?

    Is it 100% usable with mainline gcc and vanila kernels? i'm out of touch with msp430s for some time because of the retarded hops i had to take at the time.. granted i didn't look back in some time.
  13. and how do i declare the interrupts? the manual says to use signal.h http://mspgcc.sourceforge.net/manual/x918.html The code i find around uses magic strings that i can't find in msp430.h, e.g. interrupt(PORT1_VECTOR) Port_1(void) { which fail: msp430-gcc -Os -Wall -g -mmcu=msp430g2231 -c uart.c uart.c:36:6: warning: return type of
  14. btw ...should i be using something else than msp430-gcc?
  15. pretty much all the code/tutorials i find about interrupts use signal.h and it's macros. and signal.h on my current headers (msp430-gcc (GCC) 4.5.3) complains it's deprecated and 1) should not be used 2) use legacymsp430.h well, i tried #2 first, it fails. then i tried to see what I should be using instead, and failed. everything i found uses signal.h Any doc/sample code i should be looking? the manuals is all about signal.h (link to manual that i can't include because new users can't post links)
×