Jump to content
43oh

energia

Members
  • Content Count

    1,252
  • Joined

  • Last visited

  • Days Won

    63

Reputation Activity

  1. Like
    energia reacted to chicken in SPI between MSP430/432 and MCP3911   
    What LaunchPad and what version of Energia are you using?
     
    Looking at MSP430F5529 as an example, SS/SCK/MISO/MOSI are on pins 33/34/14/15 for SPI(0) and 8/7/9/10 for SPI(1).
  2. Like
    energia got a reaction from pneumatics in Energia-1.6.10R18 Windows 7 LaunchPad MSP430G2553 don't load sketch   
    Thanks for reporting this issue. I was able to reproduce it. For now you can work around it as described below. I will make a fix available in the next MSP430 package update through the board manager.
     
    copy <energia directory>\hardware\tools\DSLite\DebugServer\drivers\MSP430.dll to <energia directory>\hardware\tools\msp430\bin\ edit <energia directory>\hardware\energia\msp430\boards.txt an change the 2 occurrences of rf2500 with tilib restart energia and you should be able to upload to the MSP-EXP430G2 with MSP430G2553. I have also filed an issue on github here: https://github.com/energia/msp430-lg-core/issues/12
  3. Like
    energia got a reaction from Agam in CC3200 OS mode   
    Right now, only the bare bones implementation of the CC3200 is available in Energia. The TI-RTOS (MT) version will be added as CC3200EMT in the board manager in a week or so. 
  4. Like
    energia reacted to Fmilburn in Problem Sampling Rate MSP430F5529 in Energia   
    A bit off topic but I have been looking into driverlib and decided to rewrite Robert's code in CCS with driverlib using the TI compiler.  It is not apples to apples but I tried to get close.  It runs slower than Robert's code - it was actually faster when polled for the conversion to complete than with the interrupt as shown.  MCLK is  set to 24 MHz rather than 25 MHz.  Anyway, it was an interesting exercise.
     
    EDIT:  Use energia's code - not mine
    #include "driverlib.h" #include <stdio.h> // increase heap size to 320 in linker for printf() #define MCLK_FREQ_KHZ 24000 #define FLLREF_KHZ 32 #define UCS_MCLK_FLLREF_RATIO MCLK_FREQ_KHZ/FLLREF_KHZ #define NUM_READS 10000 #define ADC_PIN GPIO_PORT_P6,GPIO_PIN0 void setupPMM(); void setupUCS(); void setupWDT(); unsigned long milliSecs(); void setupADC(void); unsigned long readADC(void); volatile unsigned long oneThirdMillis = 0; // counter - 1/3 of a millisecond //-------------------------------- m a i n ----------------------------------- int main(void) { WDT_A_hold(WDT_A_BASE); setupPMM(); setupUCS(); setupWDT(); setupADC(); __bis_SR_register(GIE); int i; unsigned long analogValue; unsigned long mark = milliSecs(); for(i = 0; i < NUM_READS; i++){ analogValue = readADC(); } unsigned long finished = milliSecs(); printf("Time = %d ms\n", finished - mark); printf("Last value = %d mV\n", (analogValue * 3230) / 4096); // Vcc = 3.23V while(1); } //----------------------------- s e t u p A D C ------------------------------- void setupADC(void){ GPIO_setAsPeripheralModuleFunctionOutputPin(ADC_PIN); ADC12_A_init(ADC12_A_BASE, ADC12_A_SAMPLEHOLDSOURCE_SC, ADC12_A_CLOCKSOURCE_ADC12OSC, ADC12_A_CLOCKDIVIDER_1); ADC12_A_enable(ADC12_A_BASE); ADC12_A_setupSamplingTimer(ADC12_A_BASE, ADC12_A_CYCLEHOLD_4_CYCLES, ADC12_A_CYCLEHOLD_4_CYCLES, ADC12_A_MULTIPLESAMPLESDISABLE); ADC12_A_configureMemoryParam param = {0}; param.memoryBufferControlIndex = ADC12_A_MEMORY_0; param.inputSourceSelect = ADC12_A_INPUT_A0; param.positiveRefVoltageSourceSelect = ADC12_A_VREFPOS_AVCC; param.negativeRefVoltageSourceSelect = ADC12_A_VREFNEG_AVSS; param.endOfSequence = ADC12_A_NOTENDOFSEQUENCE; ADC12_A_configureMemory(ADC12_A_BASE,&param); ADC12_A_enableInterrupt(ADC12_A_BASE, ADC12_A_IE0); } //----------------------------- r e a d A D C -------------------------------- unsigned long readADC(void){ ADC12_A_startConversion(ADC12_A_BASE, ADC12_A_MEMORY_0, ADC12_A_SINGLECHANNEL); __bis_SR_register(LPM3_bits); // sleep until converted return ADC12_A_getResults(ADC12_A_BASE, ADC12_A_MEMORY_0); } //---------------------------- s e t u p P M M ------------------------------- void setupPMM(void){ // set VCore = 0 for 8 MHz and below // = 1 for 12 MHz // = 2 for 20 MHz // = 3 for 25 MHz PMM_setVCore(PMM_CORE_LEVEL_3); } //---------------------------- s e t u p U C S ------------------------------- void setupUCS(void){ UCS_initClockSignal( // use REFO for ACLK (32768 Hz) UCS_ACLK, UCS_REFOCLK_SELECT, UCS_CLOCK_DIVIDER_1); UCS_initClockSignal( // set DCO FLL ref to DFOCLK UCS_FLLREF, UCS_DCOCLK_SELECT, UCS_CLOCK_DIVIDER_1); UCS_initClockSignal( // use DFOCLK for SMCLK UCS_SMCLK, UCS_DCOCLK_SELECT, UCS_CLOCK_DIVIDER_1); UCS_initFLLSettle( // set MCLK frequency and ratio MCLK_FREQ_KHZ, UCS_MCLK_FLLREF_RATIO); } //---------------------------- s e t u p W D T ------------------------------- void setupWDT(void){ WDT_A_initIntervalTimer(WDT_A_BASE, WDT_A_CLOCKSOURCE_SMCLK, WDT_A_CLOCKDIVIDER_8192); WDT_A_start(WDT_A_BASE); //Place WDT in timer interrupt mode SFR_clearInterrupt(SFR_WATCHDOG_INTERVAL_TIMER_INTERRUPT); SFR_enableInterrupt(SFR_WATCHDOG_INTERVAL_TIMER_INTERRUPT); } //--------------------------- m i l l i S e c s ---------------------------- unsigned long milliSecs(){ return oneThirdMillis / 3; // return millis } //--------------------------- W D T _ A _ I S R ---------------------------- #if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__) #pragma vector=WDT_VECTOR __interrupt #elif defined(__GNUC__) __attribute__((interrupt(WDT_VECTOR))) #endif void WDT_A_ISR(void) { oneThirdMillis++; // count thirds of a millisecond } //------------------------- A D C 1 2 _ A _ I S R -------------------------- #if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__) #pragma vector=ADC12_VECTOR __interrupt #elif defined(__GNUC__) __attribute__((interrupt(ADC12_VECTOR))) #endif void ADC12_A_ISR(void) { switch(__even_in_range(ADC12IV,34)) { case 0: break; //Vector 0: No interrupt case 2: break; //Vector 2: ADC overflow case 4: break; //Vector 4: ADC timing overflow case 6: //Vector 6: ADC12IFG0 ADC12_A_clearInterrupt(ADC12_A_BASE, ADC12_A_IE0); __bic_SR_register_on_exit(LPM0_bits); case 8: break; //Vector 8: ADC12IFG1 case 10: break; //Vector 10: ADC12IFG2 case 12: break; //Vector 12: ADC12IFG3 case 14: break; //Vector 14: ADC12IFG4 case 16: break; //Vector 16: ADC12IFG5 case 18: break; //Vector 18: ADC12IFG6 case 20: break; //Vector 20: ADC12IFG7 case 22: break; //Vector 22: ADC12IFG8 case 24: break; //Vector 24: ADC12IFG9 case 26: break; //Vector 26: ADC12IFG10 case 28: break; //Vector 28: ADC12IFG11 case 30: break; //Vector 30: ADC12IFG12 case 32: break; //Vector 32: ADC12IFG13 case 34: break; //Vector 34: ADC12IFG14 default: break; } }
  5. Like
    energia reacted to Fmilburn in Problem Sampling Rate MSP430F5529 in Energia   
    Hi @@poliakos,
     
    The ADC converter has multiple channels (pins) that can be multiplexed to it.  The user can choose among various conversion modes:  single channel (what is being used above), repeat single channel, a sequence of channels (autoscan), or a repeated sequence of channels (repeated autoscan).  What I believe you are describing is a sequence of channels.  For the F5529, see slau208O, the Family User's Guide for a complete description.
     
    The user specifies what mode they want the ADC to operate in and then reads the appropriate register(s).  I just had a quick look at MSP430 ware for the F5529 in Code Composer Studio and there is an example for a repeated sequence of conversions.   It shouldn't be hard to change that to a single sequence if that is your objective but the ADC module is fairly complicated if you aren't used to working directly with registers.
     
    I haven't tried to incorporate this into Energia...
  6. Like
    energia got a reaction from MSP432 in Systick/timer interrupts for ADC sampling   
    The clock frequency is set at 48MHz on the MSP432.
  7. Like
    energia reacted to chicken in msp430G2553 do not start at 1.8V   
    The f_cpu variable in boards.txt file defines the clock speed of each board. F_CPU is passed into the startup code in wiring.c to configure the clocks.
     
    If you're lucky, changing boards.txt is all that's needed. If not, you will have to dig into Energia source code. wiring.c can be found it in the hardware / cores / msp430 folders.
     
    According to the G2553 datasheet page 21, 1.8V is the lowest supply voltage supported at up to 6 MHz. Even if your MCU runs down to 1.6V, I would not rely on it.
    http://www.ti.com/lit/ds/symlink/msp430g2553.pdf
  8. Like
    energia reacted to Fmilburn in MSP430G2452 and Energia   
    Hi @@pyrosmog, and welcome to 43oh...
     
    If it is the latest version 1.6.10E18 then it does not have the G2452 in the Tools->Board pulldown menu.
     
    The latest version is based on the new Arduino IDE and for some reason the G2452 isn't included. I don't know if it will be officially added in future. There are a number of threads here in 43oh on adding a new MSP430 if you want to try it yourself.
     
    The easiest thing for now may be to use an earlier version of Energia that has the G2452 such as Energia v17.
     
    Of course there could be other problems, e.g. putting the chip in upside down or not getting it seated properly.
  9. Like
    energia got a reaction from AndrewGG in Available memory after running my program   
    Seems indeed that you have a stack size issue with your loopsketch_oct04a. Unless you have deep calls and passing large amounts of data to those calls I doubt that you need more stack. Can you post your Sketch so that we can all have a look at it?
  10. Like
    energia reacted to abecedarian in Aurduino or Raspberry Pi for This Job   
    A little off topic for the forum you posted in, no?

    ?Anyhow, as far as running more than one program at a time, I suppose that would depend on what you define a program as. MSP430 can execute several tasks, simultaneously, if they are programmed accordingly.
  11. Like
    energia reacted to Rei Vilo in Aurduino or Raspberry Pi for This Job   
    On this very forum, the question would be about BeagleBone or LaunchPad.
     
    The LaunchPad MSP432 runs on Energia, based on the Arduino framework and IDE.
     
    Now, Energia features multi-tasking for the MSP432. Learn more at LaunchPad MSP432: RTOS for Everyone.
  12. Like
    energia reacted to joseroberto2 in interrupt pins on msp430F5529   
    use as porta P1_0->P1_7
  13. Like
    energia reacted to grahamf72 in interrupt pins on msp430F5529   
    Only Port 1 & Port 2 are interrupt capable. All pins on these ports are interrupt capable, i.e. P1_0->P1_7, P2_0->P2_7
  14. Like
    energia got a reaction from MSP432 in Systick/timer interrupts for ADC sampling   
    Open up the example: File-Examples->10.Multitasking->TimerLibrary.
     
    Then replace the Sketch on the first tab with the Sketch below. This Sketch sets up a timer to trigger every 500 ms. In the timer trigger function, it sets a flag that is used in the main loop to do an analogRead(). Do not perform analogRead() in the trigger function. This function is executed in the ISR context and should contain as minimal code as possible.
    #include "Timer.h" volatile uint8_t adc_flag = false; Timer myTimer; void timerFunction() { adc_flag = true; } // Add setup code void setup() { Serial.begin(115200); Serial.print(Timer_getNumTimers(), DEC); Serial.println(" timers"); Serial.print("myTimer.begin... "); myTimer.begin(timerFunction, 500); Serial.println("done"); Serial.print("myTimer.start... "); myTimer.start(); Serial.println("done"); // Set the analog resolution to 14 bits analogReadResolution(14); } // Add loop code void loop() { if (adc_flag) { adc_flag = false; uint16_t adc_val = analogRead(A0); Serial.print("Analog value: "); Serial.println(adc_val); } } Thanks to @reivilo for putting this timer library together.
  15. Like
    energia got a reaction from spirilis in CC1310 support ?   
    CC1310 is available through the board manager in Energia 18 aka Energia 1.6.10E18. Got to Tools->Board->Board Manager and look for CC13xx.
    There is also a library for the Radio called EasyLink. You can install that library through the library manager at Sketch->Include Library->Manage Libraries. Look for EasyLink.
     
    The documentation is still a work in progress but some of the API's documentation can be found here: http://energia.nu/reference/easylink/
     
    There are 2 examples Sketches included in the library. One for TX and one for RX. Make sure that you have the CC13xx board selected before you look for the examples under File->Examples->EasyLink.
  16. Like
    energia reacted to roadrunner84 in I2C for beginners   
    First of all, I2C has this oddity of using 7 bit addresses. When representing 7 bits in an 8 bit byte, it's never clear where to add the extra zero bit.
    Your device address is
    1001xxx
    But does this translate to
    01010xxx
    or to
    1010xxx0
    try using 89h instead of A2h, it might just work.
     
    Next thing, when writing 16 bit values over an 8 bit bus, make sure you have thew byte order (also called endianness) correct.
    Does 00FFh
    0000000011111111
    translate to 00h, FFh
    00000000 11111111
    or to FFh, 00h
    11111111 00000000
    so you could try either (or read back both addresses).
  17. Like
    energia got a reaction from AndrewGG in Available memory after running my program   
    It will look something like this:
    > help Available commands: dm dump memory wm write to memory (32 bits) wm2 write to memory (16 bits) wm1 write to memory (8 bits) dw digitalWrite to pin dr digitalRead from pin aw analogWrite to pin ar analogRead from pin pri Set task priority spi SPI transfer stats Print CPU utlization info help Get information on commands. Usage: help [command] > > stats Total CPU Load: 0.1 Task info: task: Idle/0x200004ec, pri: 0, stack usage: 336/1024, mode: READY load: 99.8 task: mon_loop/0x200023b8, pri: 2, stack usage: 668/2048, mode: RUNNING load: 0.1 Hwi stack usage: 440/1024 Heap usage: 2312/56400
  18. Like
    energia got a reaction from Rei Vilo in cc3200 watchdog   
    Have not tried it but the Sketch below should give you an idea of how to use the wtachdog on the CC3200. Should work for both EMT and none EMT.
    #include <stdio.h> #include <stdint.h> #include <inc/hw_types.h> #include <inc/hw_ints.h> #include <inc/hw_memmap.h> #include <driverlib/prcm.h> #include <driverlib/wdt.h> #include <driverlib/rom.h> #include <driverlib/rom_map.h> #include <driverlib/interrupt.h> #if defined(USE_TIRTOS) || defined(USE_FREERTOS) || defined(SL_PLATFORM_MULTI_THREADED) #include "osi.h" #endif volatile unsigned long g_ulWatchdogCycles; #define WD_PERIOD_MS 1000 #define MAP_SysCtlClockGet 80000000 #define MILLISECONDS_TO_TICKS(ms) ((MAP_SysCtlClockGet / 1000) * (ms)) void setup() { // put your setup code here, to run once: // // Enable the peripherals used by this example. // MAP_PRCMPeripheralClkEnable(PRCM_WDT, PRCM_RUN_MODE_CLK); // // Unlock to be able to configure the registers // MAP_WatchdogUnlock(WDT_BASE); #if defined(USE_TIRTOS) || defined(USE_FREERTOS) || defined(SL_PLATFORM_MULTI_THREADED) // USE_TIRTOS: if app uses TI-RTOS (either networking/non-networking) // USE_FREERTOS: if app uses Free-RTOS (either networking/non-networking) // SL_PLATFORM_MULTI_THREADED: if app uses any OS + networking(simplelink) osi_InterruptRegister(INT_WDT, &WatchdogIntHandler, INT_PRIORITY_LVL_1); #else MAP_IntPrioritySet(INT_WDT, INT_PRIORITY_LVL_1); MAP_WatchdogIntRegister(WDT_BASE,&WatchdogIntHandler); #endif // // Set the watchdog timer reload value // MAP_WatchdogReloadSet(WDT_BASE,MILLISECONDS_TO_TICKS(WD_PERIOD_MS)); // // Start the timer. Once the timer is started, it cannot be disable. // MAP_WatchdogEnable(WDT_BASE); } void loop() { // put your main code here, to run repeatedly: } void WatchdogIntHandler(void) { // // Clear the watchdog interrupt. // MAP_WatchdogIntClear(WDT_BASE); // // Increment our interrupt counter. // g_ulWatchdogCycles++; }
  19. Like
    energia reacted to spineless in ADXL345+MSP430f5529 4-wires SPI mode, wired outputs   
    What exactly is the issue?  I see your code does a bunch of stuff.  
     
    1. Try just looking at your code and dont include input from the hardware.   Load the registers in software to isolate the inputs....Does that prove the rest of the code is working?
     
    2. Try isolating the output by only getting your inputs then displaying the register values on the monitor. 
     
    I am unclear as to what the issue is.  Can you break it down into 5 or 10 lines of code?
     
    Spineless
  20. Like
    energia reacted to roadrunner84 in Can SoftwareSerial library work with msp430g2553   
    It looks like you're using software serial, but try to initialize your GPS module using hardware serial.
    Should the setup not call nss.write() all the time, instead of Serial.write()?
  21. Like
    energia reacted to enl in MPS430F5529L reading multiple potentiometer   
    Starting point is you have an off by one eror on the loop counter: the test should be "<5", not "<6" as you are trying to do it.
     
    But, I think the main issue is that A0, A1, etc are aliases for pin identities, not channel values. You might try:
    const int analogpins[]={A0, A1, A2, A3, A4}; . . . . for (int i=0; i<5; i++) { sensorValue=analogRead(analogpins[i]); . . .
  22. Like
    energia reacted to Fmilburn in MPS430F5529L reading multiple potentiometer   
    Hi @@morelius21
     
    You are not reading A0, A1, etc. with your code.  You are reading pin numbers.  See the pin map at http://energia.nu/wordpress/wp-content/uploads/2014/01/MSP430F5529.jpeg
     
    In your loop, you are reading pin 0 first (doesn't exist), and then pin 1 (3.3V), etc.  What you should be doing is reading from pin 23 through 27.
  23. Like
    energia got a reaction from dubnet in Available memory after running my program   
    It will look something like this:
    > help Available commands: dm dump memory wm write to memory (32 bits) wm2 write to memory (16 bits) wm1 write to memory (8 bits) dw digitalWrite to pin dr digitalRead from pin aw analogWrite to pin ar analogRead from pin pri Set task priority spi SPI transfer stats Print CPU utlization info help Get information on commands. Usage: help [command] > > stats Total CPU Load: 0.1 Task info: task: Idle/0x200004ec, pri: 0, stack usage: 336/1024, mode: READY load: 99.8 task: mon_loop/0x200023b8, pri: 2, stack usage: 668/2048, mode: RUNNING load: 0.1 Hwi stack usage: 440/1024 Heap usage: 2312/56400
  24. Like
    energia got a reaction from AndrewGG in Multiple Serial ports   
    You can use Serial1.xyz. Serial1 is located on pins 3/4 (P3_2 / P3_3). See the pinmap posted here: http://energia.nu/pin-maps/guide_msp432p401r/
  25. Like
    energia got a reaction from lalo630 in RF Wireless LCD Temp Monitor Using TM4C123 & MSP432   
    What you need is the VirtualWire library: https://www.pjrc.com/teensy/td_libs_VirtualWire.html. Unfortunately this library is arduino specific and you will need to modify it to run on TivaC and MSP432.
     
    Robert
×
×
  • Create New...