Jump to content

Search the Community

Showing results for tags 'CCS'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • News
    • Announcements
    • Suggestions
    • New users say Hi!
  • Spotlight!
    • Sponsor Spotlight
    • Sponsor Giveaways
  • Energia
    • Energia - MSP
    • Energia - TivaC/CC3XXX
    • Energia - C2000
    • Energia Libraries
  • MSP Technical Forums
    • General
    • Compilers and IDEs
    • Development Kits
    • Programmers and Debuggers
    • Code vault
    • Projects
    • Booster Packs
    • Energia
  • Tiva-C, Hercules, CCXXXX ARM Technical Forums
    • General
    • SensorTag
    • Tiva-C, Hercules, CC3XXX Launchpad Booster Packs
    • Code Vault
    • Projects
    • Compilers and IDEs
    • Development Kits and Custom Boards
  • Beagle ARM Cortex A8 Technical Forums
    • General
    • Code Snippets and Scripts
    • Cases, Capes and Plugin Boards
    • Projects
  • General Electronics Forum
    • General Electronics
    • Other Microcontrollers
  • Connect
    • Embedded Systems/Test Equipment Deals
    • Buy, Trade and Sell
    • The 43oh Store
    • Community Projects
    • Fireside Chat
  • C2000 Technical Forums
    • General
    • Development Kits
    • Code Vault
    • Projects
    • BoosterPacks

Calendars

There are no results to display.


Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Location


Interests


Sparkfun


Github

Found 58 results

  1. Hello, I am working on a project where I am trying to acquire ECG data for further analysis. Using AD8232 sensor I was able to get my raw data. So far I am using MSP430F5438A and my compiler is Code Composer Studio (CCS). I was asking if anyone did the next processing like filtering to remove noise and interference, at msp430. Can you please share your work (Analysis algorithm and Code)? Here in the attachment the graph of the raw data I am getting from my sensor (ADC values actually). Following is the link to AD8232 sensor datasheet: http://www.analog.com/media/en/technical-documentation/data-sheets/AD8232.pdf Thanks.
  2. munny

    Writing to a file

    Hello, I'm trying to write to a file and then reading back from it. I'm using code composer studio. After execution, I can see a file is created but nothing is written in it (Didn't get any error). Below is the code. What is the possible issue here? I omit the reading part as I couldn't able to write. #include <msp430.h> #include <stdio.h> void main() { WDTCTL = WDTPW + WDTHOLD; // Stop WDT FILE *fread; fread= fopen("testing", "w"); // not sure if I should add the file extention here like testing.txt but I tried including the extension also fprintf(fp, "Writing\n"); fclose(fp); } Thanks, Row
  3. munny

    Microphone data output

    Hello, I am trying to record my voice using MSP430F5438A onboard microphone. So as a starting point I am reading the microphone data(Channel 5, ADC12). I am sending the data directly to PC and observing the output at tera term. But I am confused seeing the ADC output. After a certain amount of data, the value saturates and actually doesn't change at all even if I speak or make a sound. I don't catch where I'm doing wrong. I'm attaching my code and the data output snapshot. Any suggestion is highly appreciated. #include <msp430.h> unsigned int voice; volatile unsigned char volt [5]; void init_serial (void); void init_serial (void) { P5SEL |= 0xC0; // 5.6 and 5.7 for TX/RX- UCA1 UCA1CTL1 |= UCSWRST; UCA1CTL1 |= UCSSEL_1; //32768 Hz UCA1BR0 = 03; // Baudrate 9600 UCA1BR1 = 0x00; UCA1MCTL = 0x06; // Modulation Sx=3, Fx= 0 UCA1CTL0 = 0x00; UCA1CTL1 &= ~UCSWRST; // In operation mode } void ADC_value (int); void ADC_value (int ADC_Data) { volatile char x=3; volt [3] = volt [2] = volt [1] = volt [0] = 0x30; while (ADC_Data > 0) { volt [x] = (ADC_Data%10)| 0x30; // Separating unit digit ADC_Data = ADC_Data/10; // rest of the digit than last digit x--; } volt [4] = '\0'; } void Send_Serial (void); void Send_Serial (void) { volatile char i=0; while (volt[i] != '\0') { UCA1TXBUF = volt[i]; while (UCA1STAT & UCBUSY); i++; } UCA1TXBUF = 0x0a; while (UCA1STAT & UCBUSY); UCA1TXBUF = 0x0d; while (UCA1STAT & UCBUSY); } int main(void) { P6OUT |= BIT4; // microphone power P6OUT &= ~BIT5; // microphone connected at input channel 5 P6SEL |= BIT5; WDTCTL = WDTPW + WDTHOLD; // Stop WDT /* Initialize the shared reference module */ REFCTL0 |= REFMSTR + REFVSEL_0 + REFON; // Enable internal 1.5V reference /* Initialize ADC12_A */ ADC12CTL0 &= ~ADC12ENC; // Ensure ENC ADC12CTL0 = ADC12ON + ADC12SHT02; // Set sample time ADC12CTL1 = ADC12SHP + ADC12SSEL_3; // Enable sample timer ADC12MCTL0 = ADC12INCH_5; // ADC input ch A5 => MIC init_serial (); while (1) { ADC12CTL0 &= ~ADC12SC; ADC12CTL0 |= ADC12SC + ADC12ENC; while (ADC12CTL1 & ADC12BUSY) __no_operation(); voice = ADC12MEM0; ADC_value (voice); Send_Serial (); } } User guide: http://www.ti.com/lit/ug/slau263i/slau263i.pdf
  4. munny

    ADC12 timer trigger

    Hello, I am trying to collect data from the following optical dust sensor: https://www.sparkfun.com/datasheets/Sensors/gp2y1010au_e.pdf According to page 5 of the datasheet, I generated the correct PWM signal using timer A for input PIN 3 of the sensor and observed the signal in my oscilloscope. Now at the same page Figure 2, they talked about the output pulse sample timing. Anyone can help me understand how should I set up my ADC12 for this? Few queries regarding this: 1. Should my sample and hold time be 0.28ms? 2. If so then should I wait for next 0.04ms + 9.68ms to collect my next ADC value as the next input pulse needs that much time to arrive? 3. If 1 and 2 are correct, how can I set up my ADC for this? Just for information, I am using MSP430F5438A, IDE: Code Composer Studio Thanks, Row
  5. munny

    Microphone MSP430F5438A

    Hello, I am planning to analyze breathing pattern using a microphone. I have MSP430F5438A Experimental board. I found that the board itself has a microphone. I am looking for any documentation available about how to use the microphone from the board. I did a little bit of research but didn't find details other than the user guide for the board. I appreciate any recommendation. Thanks, Row
  6. ironoman

    Energia Support MSP430FR6972

    I am trying to add MSP430FR6972 in Energia. So far i have edited board.txt , board.mk but the pin_energia.h seems alot complicated than the previous two. So i need some help in doing so. I think the way i am adding a new board in energia might be wrong so just point me in the right direction and i will do the rest.
  7. Trying to work with SPPDemo (MSP430F5438A+ CC2564B) according to the steps described at the link below: http://processors.wiki.ti.com/index.php/CC256x_TI_Bluetooth_Stack_SPPDemo_App I was able to open the server. But on the client side, I can't see the device list with DisplayInquiryList Command. I tried Inquiry command before it to initialize the process. Both the pictures of server and client are added.
  8. Markers

    Energia.core

    Hi, I was working on an imported Energia project in CCS when I was informed that a software update to CCS was available. I installed the upgrade and restarted CCS in my project which now will not build. Instead I get the message "Buildfile generation error occurred.. Product 'energia.core' v18.0 is not currently installed and no compatible version is available. Please install this product or a compatible version. Build stopped.." My version of Energia is the latest (18). Can anyone help please! Thanks, Mark
  9. Hello, I have obtained a PWM code online written in C. What is the equivalent code if it is written in Energia - .ino file using Energia IDE libraries? Here is the code: #include <msp430g2553.h> void setup() { WDTCTL = WDTPW + WDTHOLD; // Stop WDT if (CALBC1_1MHZ==0xFF) // If calibration constant erased { while(1); // do not load, trap CPU!! } DCOCTL = 0; // Select lowest DCOx and MODx settings BCSCTL1 = CALBC1_1MHZ; // Set range DCOCTL = CALDCO_1MHZ; // Set DCO step + modulation */ P1DIR |= BIT6; P1SEL |= BIT6; TACCR0 = 20000-1; // PWM Period 20us (substract 1 because it's 0-based) TACCTL1 = OUTMOD_3; TACCR1 = 10000; // CCR1 PWM duty cycle TACTL = TASSEL_2 + MC_1; // SMCLK, up mode _BIS_SR(CPUOFF); // Enter LPM0 } Any help is much appreciated.
  10. Hello, Can anyone help me with the source code for the pulse oximeter of the MAX30100 sensor (I2C communication)? Following is the datasheet: https://datasheets.maximintegrated.com/en/ds/MAX30100.pdf I'm using MSP430F5438A. Thanks.
  11. I am working with the MSP430F5529 Launchpad w/the Pervasive Display Gen2 EXT2 board and various eInk displays (BW, BWR). There seems to be a wide array of official(?) and unofficial SDKs, FW dev kits, boosterpacks, etc. available with varying degrees of compatibility with this particular LaunchPad. I am looking for some basic pointers on creating a simple GUI tool for sending images to the display. I can compile the latest 1.21 FW (via CCS using PDI Apps as target), flash the FW and run the (precompiled) PDI Apps Ver 1.21.exe GUI tool to send images to display, however it seems there is no source code for this GUI tool provided(?). Or, am I just not looking in the right place? Is there a project and/or document that explains/demonstrates creating a simple GUI or command line to interface with the hardware (for example making calls to the PDI_apps_drivers command handlers) to send an image to the display. So far I have found two projects which seem to have potential for good starting point(?): CCS IDE and EPD Extension Board Gen2 (EXT2)_v1.21 using the PDI Apps target _preferable_ (or the MSP430F5529 specific example target). Energia IDE (or Visual Micro MSVS plugin) and EPD_Demo.ino with the Pervasive_EPD_BoosterPack2 (I'd prefer to use C++, but not completely opposed to python if necessary as starting point.) Thanks for any pointers in the right direction.
  12. biza

    MSP432P401R I2C +TMP006

    Hi fellows, I have some facing some problems with interface on sensor TMP006, now I have done the I2C driver in CMSIS, the problem is in the TMP006 file, I can not configure the registers to make the conection with i2c protocol I2C.c I2C.h tmp006.c tmp006.h
  13. biza

    MSP432 RTC User adjust

    can anyone some help me? I have some problems with user rtc configuration in msp432 I made a firmware where the user choose by hardware configuration adjust date and time (alarm clock). The problem is ... after the user adjust date and time I would like use the rtc to control the watch and show the current date and time in a lcd. The problem is ... after the user adjust date and time I would like use the rtc to control the watch and show the current date and time in a lcd. Soo i need some help in two things pass the user value (decimal) to hexadecimal or BCD and the inverse get the hexadecimal or BCD value to decimal to show in LCD . I'am using CCS, in CMSIS on attach i leave the code I have made to test it!
  14. biza

    MSP432 RTC User adjust

    can anyone some help me? I have some problems with user rtc configuration in msp432 I made a firmware where the user choose by hardware configuration adjust date and time (alarm clock). The problem is ... after the user adjust date and time I would like use the rtc to control the watch and show the current date and time in a lcd. The problem is ... after the user adjust date and time I would like use the rtc to control the watch and show the current date and time in a lcd. Soo i need some help in two things pass the user value (decimal) to hexadecimal or BCD and the inverse get the hexadecimal or BCD value to decimal to show in LCD . I'am using CCS, in CMSIS on attach i leave the code I have made to test it! test.zip
  15. I'm using the FRC Gamepad Tool to load the TI-supplied firmware for a USD HID joystick with a KMA210 magnetic angle sensor. I have a voltage divider taking the KMA210's 5V max output to 3.3V, and when plugging in the MSP and checking the windows game controllers, an axis does respond when I turn a magnet near the sensor, but the reading is all over the place. Bouncing back and forth by 40% of the whole angle range. I've tried using an external 5V supply, tried changing the sampling on the ADC, the Vref, the clock multiplier, the wires, the input pin, just about everything. Does anyone have any advice?
  16. This project is an offshoot of an earlier investigation of wireless wearables using the MSP430G2553: http://forum.43oh.com/topic/10060-msp430-wearable-with-radio/. The concept has been successfully tested and is described below. I plan regular updates as the project progresses. The objective is to develop a wearable powered by a coin cell that can be controlled remotely. It could be used, as an example, in the tiara below or on a costume worn by dancers in a performance and controlled from offstage. In the photo an earlier MSP430G2553 coin cell powered wearable is attached to the tiara and driving 3 WS2812 LEDs. The constraints are: cost - unit cost for the receiver of $10 or less technology - common off the shelf components, MSP430G2553 construction - standard double sided PCB spec, keep SMD parts large enough to be hand soldered power - CR2032 (rated 3V and 225 mAH) life - needs to run at least half an hour on fresh batteries reception - 10m with clear line of sight, update at least every 100 ms transmission - desirable but not required size - 40mm/1.6" diameter for receiver programming - Energia desirable schedule - 6 month completion The transmitter will probably be placed on a "Booster Pack" for a LaunchPad running Energia. Multiple LEDs will be driven to gain extra distance, and if required multiple transmitters could be set up from different angles to assure good reception. A display would be helpful as on the FR6989 shown below with an IR LED. The initial Energia transmission sketch to test the concept is located here: https://github.com/fmilburn3/Infrared/blob/master/IR_sendByte.ino. The sketch was developed in Energia V17 using a MSP430G2553 LaunchPad and a 940 nm infrared LED. It loops from 0 to 255 and sends a single byte with the count via infrared to the receiver when a button is pushed. The packets for sending bytes do not follow an existing protocol. It is specific to this application and developed with the goal of getting a byte transmitted at least every 100 ms. The receiver will be a custom MSP430G2553 board powered by a coin cell with a TSOP38238 IR receiver. There will LEDs on the PCB and it will also have the capability to drive LEDs off board. The preliminary receiver code was written in C using CCS and direct register access: https://github.com/fmilburn3/Infrared/blob/master/IR_Receiver/main.c . The framework for the code is based on a post by RobG here on 43oh. The receiver takes transmissions from the Energia sketch linked above and outputs the current byte on eight LEDs in binary form. When the last byte is received it clears the LEDs and outputs the number of bytes received in error out of the expected 255. This allows analysis of reception at different distances and conditions. Shown below is the preliminary testing setup. In the foreground is the G2553 receiver with a TSOP38238 and output LEDs on a breadboard. Middle ground is a G2553 with the infrared LED sending bytes. Background is output from the receiver being monitored on an oscilloscope. The output of the TSOP38238 is quite clean and no errors were seen with the transmitter and receiver this close together. Transmission is at approximately 1000 bytes per minute or 16+ bytes/sec which is within the desired range. I subsequently modified the test setup to run off batteries so I could do some preliminary distance testing. With clear line of sight reception I saw no errors up to 5 meters with one transmission LED aimed directly at the receiver. Errors crept in after that, especially if the transmission is off to one side, not pointed directly at the receiver, or at a greater distance. Near term activities: increase the number of transmission LEDs evaluate the impact of off-center transmission further test in an environment that doesn't have reflective surfaces add WS2812 driver capability and investigating the impact of TSOP38238 interrupts on the WS2812 driver evaluate 2032 battery life further
  17. admirlk

    CCS7 Requirements

    It appears that CCS requires certain Windows Updates to be installed, before it can be installed. I found one of the two missing ones, but Windows Updates have been broken for several years on my machine. In other words, the 26k file I found is at 0% after 10 minutes. The last time I tried a similar sized update, it was at 0% after 24 hours. I will leave this going for now, but am not expecting it to get past 0%. I noticed in another thread that the CCS6 license is now free and found the download for it. I am curious if an older version will have the same requirements, or not. I have had Eclipse installed within the last year or so, so if this has to do with Eclipse I am thinking it will work. If it has to do with the plugin, I might still be out of luck. Since this the "defacto" IDE, I would prefer to use it. Any help or advise is appreciated.
  18. Hello, I'm not used to playing with C/C++ or even with compiled languages so maybe it'll be a dumb question but after a lot of research, I don't know what to do. I have an issue at compilation in a CCS project for CC3200 and I've already posted a question in the compiler section of TI's forum. I got help : I know now that my error is that I'm trying to use methods defined in a header file without having the corresponding source file in the project. So I am getting an "undefined symbol" error on theses methods, as you can see on the following screenshot. As I started my project in Energia IDE, I did some code using Energia's methods. Going on doing the project, I needed to add Free-RTOS. I never used Free-RTOS before so I took a demo project of Free-RTOS implementation for CC3200 as a base to do it. I succeeded to compile the demo project on my board. Also, I imported my Energia sketch in my CCS workspace and I was also able to build it and run it correctly on the board (via CCS). But then I tried to combine both project, and now I'm stuck with an issue. I added code from my Energia Sketch in the Free-RTOS demo project. As I am using Energia methods and constants such as digitalWrite or pinMode, I was not surprised that the IDE and the compiler couldn't find them. I investigated a bit to find out where these methods where defined and I found them in Energia.h. That's why I firstly tried to import this header only. Now that I have understood that I need the source file :), but I can't find it ! My last try was to look at the imports/symbols and file search paths of my imported Energia sketch in CCS (like the following) : - Imported Energia sketch project - Free-RTOS demo project (my project) I also read things about "lpcc3200_core" folder which was added when I imported the Energia Sketch. Maybe this is the core files that I need ? I'm still stuck and now I wonder if it's even possible to correctly import Energia framework this way, or if I should either choose TI-RTOS or write again my Sketch directly in C/C++. Thanks for reading me !
  19. CCS 7.1.0, Energia 1.6.10E18, Windows 10 x64 Any scetch, even empty one generates the same set of errors concerning definite files: subdir_rules.mk, IPAddress.cpp, MACAddress.cpp, main.cpp, WInterrupts.c: fatal error: Arduino.h: No such file or directory, fatal error: avr/pgmspace.h: No such file or directory, fatal error: Energia.h: No such file or directory fatal error: itoa.h: No such file or directory gmake: *** [xxx.o] Error 1 recipe for target xxx.o failed ending compilation as: Cannot build project. Referenced project 'CC3200-LAUNCHXL_core' contains build-errors. Separatelly, Energia IDE itself and CCS works fine. Path to Energia set correctly. Any help wanted.
  20. I designed a board using a MSP430G2553IPW28R its the 28 pin tssop package. I read on this forum that you can use the launchpad to program the part I have some code written and can program a 20 pin device but when i connect the wires to my board from the launchpad is cant find the device or its not there. Error connecting to the target: Could not find device (or device not supported) I used CCS and just for the hell of it did the MSP-EXP430G2-LaunchPad User Experience Application example which programs just fine but i get the same error when plugged onto my board. Here is how i connected the part to the launchpad. Yes 20 pin IC removed from launchpad. I am at a loss. My board is powered from its own 3.3v supply and the grounds are common. The ground is always connected between the launchpad and the proto board. for testing i just remove/reconnect the 2 spy-by-wire pins and add/remove the 20 pin g2553 for testing the output. The 28 pin parts are new from mouser and i have 2 boards that i built that do the same thing. Any help would be nice
  21. Hello fellows, I need some help, with a situation, I want convert some analog signals to digital and send him by the UART communication, but I dont get how to solve this problem. my digital values is represented by "tempADC" variable, soo how can I get a buffer with values to the pc with UART communication. I try many things, but i dont understand how to put my output signal in the terminal in this format. temperature: 40º temperature: 41º temperature: 42º temperature: 43º can anyone help me?! my code: #include "uart_Tx.h" #include "stdio.h" void UART_TxConfig(void){ /*CLOCK SYSTEM SUPORT (CS)*/ CS->KEY = 0x695A;/*UNLOCK ALL 16 LSB CS REGISTERS*/ CS->CTL0 = 0;/*RESET PARAMETERS*/ CS->CTL0 = CS_CTL0_DCORSEL_5;/**/ /*CLOCK SYSTEM*/ /*SELA_2 ACLK = REFOCLK*/ /*SELS_3 SMCLK = DCOCLK*/ /*SELM_3 MCLK = DCOCLK*/ CS->CTL1 = CS_CTL1_SELA_2 | CS_CTL1_SELS_3 | CS_CTL1_SELM_3; /*LOCK ACESSES TO REGISTERS*/ CS->KEY = 0;/*UNLOCK ALL 16 LSB CS REGISTERS*/ /*UART PIN CONFIGURATION*/ P1-> SEL0 |= BIT2 | BIT3; /*SET 2 UART PIN's*/ /*ACTIVE INTERRUPTION's*/ __enable_interrupt(); /*ACTIVE eUSCIA0 INTERRUPT IN NVIC MODULE*/ NVIC->ISER[0] = 1 << ((EUSCIA0_IRQn) & 31); /*CONFIGURE UART*/ UCA0CTLW0 |= UCSWRST; UCA0CTLW0 |= UCSSEL__SMCLK;/*SELECT SMCLK CLOCK SOURCE*/ /*BAUD RATE CALCULATION * BAUD RATE DIVISOR (TRANSMITIONS RATE) * 12MHz/(16*9600) = 78.125 VELOCITY *FRACTIONAL PORTION = 0.125 *FRACTIONAL */ UCA0BR0 = 26; /*48000000/16/115200*/ UCA0BR1 = 0x00; UCA0MCTLW = 0x1000 | UCOS16 | 0x0020; /*CONTROL WORD REGISTER*/ UCA0CTLW0 &= ~UCSWRST; /*SOFTWARE RESET DISABLE*/ UCA0IE |=UCRXIE; while(1){ } } /*UART INTERRUPT SERVICE ROUTINE*/ void EUSCIA0_IRQHandler (void){ if (UCA0IFG & UCRXIFG){ while(!(UCA0IFG & UCTXIFG)); UCA0TXBUF = UCA0RXBUF; //UCA0TXBUF = adcTemp; //P1->OUT ^= BIT0; } }
  22. Hello all! So, this is happening on BOTH my Ubuntu 16.04 AND Windows 8.1 systems. This is for a TM4C1294NCPDT. To reduce potential variables, I've reverted to using the EK-TM4C1294XL Development Board. To reproduce: Fresh install of CCSv7.1, Fresh install of Energia 18. Open CCSv7, Create a new workspace, select 'Project > New Energia Sketch', Energia Version set to 18, select 'Built-in Examples > 01.Basics > Blink.ino', selected device: 'LaunchPad (Tiva C) w/ tm4c129 (120MHz), select 'Finish'. Right Click 'Blink" project in the Project Explorer, select "Build Project'. Project builds fine. Push F11 (or select 'Debug Blink' from the toolbar). Code is uploaded, but the debug 'Resume' button is grayed out. LED does not blink. Note: 'Blink' runs fine in the Energia IDE itself. What happened in the update to CCSv7? I'm taking a shot in the dark here, but I think the memory map is b0rked. If I disable "On a program load or restart" in the 'Debug > Auto Run and Launch Options' and then attempt to debug, CCS starts the debugger at "void ResetISR(void) {" in startup_gcc.c. See attached image for disassembly view. I think (IIRC) that the two ldr calls in assembly are usually right below that 'push', but my memory ain't what it used to be. Anyhow, if I try to 'Step Into' with F5, I immediately get a dreaded "No source available for "0xfffffffe" ... So, any idea what the hell happened? This shoots me dead until this is resolved... I figured TI would at least test Energia GCC debugging before releasing v7, though I do tend to err with my assumptions quite often. If you need anything, just holler. EDIT: For posterity, here's my TI E2E forum post on the same: https://e2e.ti.com/support/development_tools/code_composer_studio/f/81/t/586137
  23. Hi, I needed a way to see how much of my C++ stack was being consumed in my MSP application - the traditional way is to "poison" the stack with a known pattern, and then to see how much of it gets burnt away. So I wrote the following - hope folk find it useful: The following code allows you to simply do this and to check at any point how much of the pre-allocated stack was consumed during peak usage, i.e. how close your app got to the bottom of the stack, or indeed, whether it over-ran. The TI CCS documentation is completely wrong in the names it gives for the global symbols that define the size and start of the stack - needs to be updated, Stick this code (or similar) wherever you want to report on/check stack usage <smallest number of byes left free on the stack since initialisation>/<configured size of the stack>. #if defined(STACK_CHECK) std::printf( "Stack: %d/%d\n", stackMinFreeCount(), stackMaxSize() ); #endif and then, in your main code you need to poison the stack as early as possible and then define the reporting routines: // Define STACK_CHECK to include stack usage diagnostics #define STACK_CHECK #if defined(STACK_CHECK) #define STACK_INIT 0xBEEF // Pattern to use to initially poison the stack extern uint16_t _stack; // Start of stack (low address) uint16_t stackMinFreeCount(void); uint16_t stackMaxSize(void); #endif #if defined(__cplusplus) extern "C" { #endif #if defined(__TI_COMPILER_VERSION__) || \ defined(__GNUC__) int _system_pre_init( void ) #elif defined(__IAR_SYSTEMS_ICC__) int __low_level_init( void ) #endif { //... stuff... #if defined(STACK_CHECK) // // Poison the stack, word by word, with a defined pattern // // Note that _system_pre_init is the earliest that we can // do this and that it may not be possible in TI-RTOS // // When we call the __get_SP_register intrinsic (same on IAR & CCS), it will return the address // of the RET address for the caller of this routine. Make sure that we don't trash it!! // register uint16_t *stack = &_stack; // Address of lowest address in .stack section register uint16_t *stack_top = reinterpret_cast<uint16_t *>(__get_SP_register()); do { *stack++ = STACK_INIT; // Poison stack addresses } while (stack < stack_top); // Stop before top of stack to leave RET address #endif return 1; } #if defined(__cplusplus) } #endif #if defined(STACK_CHECK) /** * Check how deep the stack usage has been * * \return \c uint16_t Minimum number of bytes to bottom of stack */ extern uint16_t __STACK_END; // End of data extern uint16_t __STACK_SIZE; // Linker-set size of stack uint16_t stackMinFreeCount(void) { const uint16_t *stack = &_stack; uint16_t freeCount = 0; while (*stack == STACK_INIT && stack++ <= &__STACK_END) { freeCount++; } return freeCount << 1; } /** * Return size of C++ stack * * Set by the linker --stack_size option * * \return \c uint16_t Configued maximum size of the stack in bytes */ uint16_t stackMaxSize(void) { return static_cast<uint16_t>( _symval(&__STACK_SIZE) ); } #endif int main(void) { ... stuff #if defined(STACK_CHECK) std::printf( "Stack: %d/%d\n", stackMinFreeCount(), stackMaxSize() ); #endif ...stuff }
  24. Unit

    MSP430F5529 JSON Code

    Hello Forums I am trying to use GUI Composer v2 (on the cloud) to create a GUI for a battery managment system, similar to the one in the SLAA478 Application Report, using the MSP-EXP430F5529LP and bq76PL536EVM-3. I've decided to use USB/Serial comms, which requires me to modify the code to send the information using JSON. I am following the example of using USB/Serial IO: https://dev.ti.com/gc/designer/help/Tutorials/Serial/index.html. The code given is as follows: #include <aJSON.h> // most launchpads have a red LED #define LED RED_LED //see pins_energia.h for more LED definitions void printled_statewithjson(int state){ aJsonObject* root = aJson.createObject(); if (root == NULL) { return; } aJson.addItemToObject(root, "LED", aJson.createItem(state)); char* string = aJson.print(root); if (string != NULL) { Serial.println(string); free(string); } aJson.deleteItem(root); } // the setup routine runs once when you press reset: void setup() { // initialize the digital pin as an output. pinMode(LED, OUTPUT); Serial.begin(9600); } // the loop routine runs over and over again forever: void loop() { digitalWrite(LED, HIGH); // turn the LED on (HIGH is the voltage level) printled_statewithjson(1); // print json object with LED status set to 1 to UART delay(1000); // wait for a second digitalWrite(LED, LOW); // turn the LED off by making the voltage LOW printled_statewithjson(0); // print json object with LED status set to 0 to UART delay(1000); // wait for a second } I am trying to fully understand this example code, before implementing it into my program. Using CCS Cloud, I stepped through the program in debug mode. From what I understand, the loop() function is essentially the main function, which blinks the LED; setup() does as expected and initializes the MCU LED pin, and opening a serial port at 9600 baud rate. I cannot, however, understand the printled_statewithjson() function. How exactly does it work to be able to send the information? Regards
  25. Good Morning, This may be the wrong place to ask this question. If so, please let me know where to ask it.. I've been a Windows programmer for 20 years. I've pretty much stuck to User Interface development the whole time. I have been using .net and C# for the past 10 years so I am VERY SPOILED when it comes to letting the language do the grunt work and I finesse the code. I now find myself working on a personal project which requires me to program the MSP430G2553 controller. I started out by using Energia (which if you don't know, is a fork off of Arduino) The advantage of it is you can do a lot with very little code and without needing to know all the guts of the MSP430G2553. The disadvantages are that sometimes it doesn't work right. Sometimes it doesn't give you the control you need, sometimes it's hard to figure out if Energia isn't working, or if your code isn't working... Anyway, I've spent hundreds of hours getting parts of my program to work. I have been trying to get away with not having to learn how to write firmware and have to deal directly with the processor. However, I'm starting to think that I need to bite the bullet and take the time to overcome my learning curve and dive in headfirst to firmware development and the paradigm shift that comes with it. The program I am using needs to have control over changing into and out of the various Low Power Modes on the MSP430. I need to listen for interrupts. I need to use I2C to communicate with various devices that are connected to the MSP430. I need to monitor Power Level/Consumption from time to time. So, basically, I have the following questions: 1. Can Energia robustly and without errors do the above things? 2. Am I wasting my time getting all of the above accomplished using Energia? 3. Should I be using Code Composer Studio? 4. Having NEVER developed ANY controller level code outside of Arduino and Energia, what kind of Learning Curve am I looking at to accomplish the above things? 5. Where is the best place to start learning this? 6. Where is the best place to look for answers to MSP430 development questions? Thank you all in advance for any assistance and advice you might have.
×