curtis63 reacted to LiviuM in OpenCollector vs INPUT, OUTPUT, INPUT_PULLUP PinModes...
never done this, but I suppose you can generate the i2c behavior by switching the pins between input (with pull-up) for logic high and output low for logic low.
curtis63 reacted to Rei Vilo in OpenCollector vs INPUT, OUTPUT, INPUT_PULLUP PinModes...
Which board are you using?
curtis63 reacted to LiviuM in To I2C or not to I2C, that is the question...
in my opinion, your pins file has a problem with the (hardware) i2c pins. In my opinion, the TWISDA should be == with TWISDA0 and TWISCL should be == with TWISCL0. In your file there are defined as:
static const uint8_t TWISDA = 22; /* P1.7 */ static const uint8_t TWISCL = 21; /* P1.6 */ static const uint8_t TWISDA0 = 23; /* P1.7 */ static const uint8_t TWISCL0 = 22; /* P1.6 */ I think they should be
static const uint8_t TWISDA = 22; /* P1.7 */ static const uint8_t TWISCL = 21; /* P1.6 */ static const uint8_t TWISDA0 = 22; /* P1.7 */ static const uint8_t TWISCL0 = 21; /* P1.6 */ Attached is the pins_energia.h file with the above correction and with some minor "visual" changes - made the correct footprint for the 32 pins chip, aligned the comments...
curtis63 reacted to energia 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
curtis63 got a reaction from energia in i2c not working with Energia for MSP430G2553 inside Code Composer Studio
I am using the latest version: energia-0101E0017. I just reloaded it from Energia's website this morning. It is their December 2015 version.
I am using the latest CCS version 6.1.3. I installed a fresh version of that a couple days ago and have applied all the updates I could find.
Using the very popular I2C_Scan tool, I get bad results. I either get all addresses telling me there's a device there, or if I do a write(0); between begin and end transmission, I get no devices...
See brief code snip below:
void findAddress(int fromAddress, int toAddress)
for (int a = fromAddress; a < toAddress; a++)
int endStatus = Wire.endTransmission();
if (endStatus == 0)
Serial.print("Found device at: 0x");
When using Arduino with the same I2C_Scan tool, I can quickly discover my i2c device.
So, can somebody let me know why this isn't working, and/or perhaps point me to a work-around?
I've read many of the postings about this and have done the following:
Removed jumper from LED for P1_6
Used resisters to give step-up or whatever you call it
Tried it with and without the Write(0) between the begin and end transmission code above
Anyway, just a bit frustrated today. I'm a spoiled Software Engineer, not used to the pain that is endured each day by firmware developers as they fight as hard against the development tools as they do against the code they write :-)
curtis63 got a reaction from tripwire in MSP-EXP430FR5969 upgrade from 1.2 to 2.0. Can it be done ?
Ah!!! Thank you everybody. You are right. I was looking above the JTAG socket and saw rev 1.2. However, the board rev is 2.0 on my board as displayed on the upper right hand side of the board, as pictured in the post above.
Thanks for clearing that up for me. I really appreciate it !!
curtis63 reacted to dubnet in Error communicating EnergyTrace pod. How do I use Energy Trace?
A quick search on the site revealed this: http://43oh.com/2015/09/how-to-measure-an-energia-applications-power-usage-with-energytrace/
curtis63 reacted to chicken in Where do I find an energia library for MMA8653FCR1 ?
Sorry, carefully reading your question might help me to actually answer it
Looking at the datasheet of the MMA8653, I think the relevant chapters are 6.7 (freefall / motion detect registers) and 6.9.3 through 6.9.5 (CTRL_REG3-5, interrupt configuration registers).
In the linked Arduino code, ctrl_reg3-5 are already available. Add values for the motion detect registers.
int ff_mt_cfg = 0x15; // Freefall/motion configuration register int ff_mt_src = 0x16; // Freefall/motion source register int ff_mt_ths = 0x17; // Freefall/motion threshold register int ff_mt_count = 0x18; // Freefall/motion debounce register (Personally I'd use #define reg_name reg_address for this, but I will stick with the style of the Arduino code linked above)
You can use the I2C_SEND function in the Arduino code to set the registers to the desired values. I'd expand on the example's ACC_INIT function.
1. Set the desired detection mode with the bits in FF_MT_CFG.
Set bit 6 to 1 (OAE, detect mode, 0 = freefall, 1 = motion). Motion means, any axis measures above the threshold
Set bits 3, 4, 5 to 1 for the axis you want to detect on (XEFE, YEFE, ZEFE, representing x, y, z respectively).
Leave the other bits at 0.
0x78 looks like a reasonable value. You may need to exclude the axis of gravity when trying to detect motion < 1g.
2. Set the desired threshold at which motion is detected in FF_MT_THS
Set this register to a value between 0 and 127, representing 0 to 8g.
The register also has a flag (bit 7, DBCNTM) that determines how debouncing works. I think leaving it at 0 is fine.
0x20 would set about 2g as trigger level, be careful with values < 1g to avoid detecting gravity as motion.
3. Set how many samples are needed to trigger the motion detection in FF_MT_COUNT
Set this register to a value between 0 and 255. The duration depends on the update rate (ODR), which the Arduino example set to 800Hz. So each sample represents a 1/800th of a second. I'd experiment with values around 10 and lower it when reaction is too sluggish or increase it if detection is triggered randomly.
0x0a represents a debounce counter value of 10.
4. Optional: Set the interrupt pin we want to wiggle in CTRL_REG5
Bit 2 controls the interrupt pin for motion detection, either INT1 (1) or INT2 (0).
Default is INT2, so we only need to write to this register if we want to use the INT1 pin.
5. Optional: Set how the pin wiggles CTRL_REG3
Bit 1 (IPOL) selects, whether the pin goes high to low or low to high when an interrupt occurs. Default is going from high to low.
You will also need to look into this register if you use the sleep modes of the accelerometer.
0x01 will make the interrupt pin go high when motion is detected
6. Enable interrupt from motion detection in CTRL_REG4
Bit 2 enables the freefall/motion interrupt.
0x02 will enable the interrupt.
So in summary:
I2C_SEND(ff_mt_cfg, 0x78); // motion detection, x, y, z I2C_SEND(ff_mt_ths, 0x20); // 2g I2C_SEND(ff_mt_count, 0x0a); // debounce over 10 readings I2C_SEND(ctrl_reg4, 0x02); // enable motion interrupt (default is INT2 pin) When you connect INT2 pin of the accelerometer to the MSP430, you can then use DigitalRead or AttachInterrupt to react to the signal.
All the above is just theoretical as I don't have this chip at hand. But I obviously had too much time at hand
curtis63 got a reaction from tripwire in Time for another ENERGIA RELEASE !
This probably belongs in the suggestions section, but I couldn't find that so I'm posting it here. Moderators, please move this to the appropriate place...
Anyway, I would like to suggest that the powers that be PLEASE release a new version of ENERGIA.
There are 2 huge glaring problems in the current release.
1. I2C Scanner doesn't work for MSP430G2553
2. There is no support for 28 pin versions of the MSP430G2553
Both of these issues have been addressed and fixed in various GitHub code. However, it has not been merged into Energia and applied to a new release of Energia.
I have downloaded energia and applied the above 2 patches and am running just fine. However, it seems like 4 months since the last release of code is a very long code cycle.
Please release an updated version with all the fixes to date included, so that it works well right off the shelf without having to hack it to death.
By the way, ENERGIA IS AWESOME !!!!!!!!!!!!!!!!!!!!!!!!!!!!! I really love it.. Let's just update it and so new users will love it as much as I do, without having the hassle of having to manually patch parts of it.
curtis63 reacted to cubeberg in Access to all MSP430 timers.
Some of the timers are already in use under the covers - executing the loop on a specific interval, tracking time (millis/micros), etc. so losing some is a trade-off of using Energia vs Code Composer or mspgcc.
You'll find that some libraries use timers as well, so you'll need to watch out for that as well.
I believe you can technically use interrupts within Energia like you would with MSPGCC, there just isn't a nice wrapper for everything. Keep in mind that it's intended to be hardware agnostic to an extent as well - so that your code could work on an MSP430, but also an MSP432 or Tiva if you need more horsepower.
Depending on what you're looking to do - it may be a case of finding a different way of approaching the problem, maybe taking the time to write a library for a special function, or possibly making the jump to Code Composer (there's even a nice import function in Code Composer for Energia sketches).
FYI - I'm a C# dev as well. With enough digging through examples - the MSP430 is not too difficult to master although it seems daunting at first (the code samples they provide for the 2553 are fantastic though and Grace is very valuable for configuring tricky timers and peripherals). Now a CC3200 or MSP432 - that's a whole different beast - I tend to use Energia for larger chips since I haven't invested enough time on learning the driverlibs and architecture yet.
curtis63 reacted to roadrunner84 in Access to all MSP430 timers.
There are multiple types of timers, of which one, more or no peripherals may be present in any specific msp430.
For example, the msp430g2553 has the WDT+ module, in addition to two Timer_A modules. Each of those timers has three capture/compare registers.
The msp430fr2532 on the other hand has four Timer_A modules, of which two have two CC registers, and two have three CC registers.
As you can see, the existence of a certain module does not mean it is present in your specific type.
curtis63 reacted to spirilis in HardwareSerial::write() and other HardwareSerial functions locking up..
That can happen if the TX queue is full. It continues until a byte entry frees (via UART TX IRQ firing and getting serviced) thus allowing write to proceed. Under what circumstance are you experiencing this? If you are using write() inside an Interrupt callback, do not do this, it's an unsafe operation that can lock up your firmware.