Website URL

Location

Interests

Sparkfun

Github

Hey all,
I've currently got an issue where i2c just isn't working with energia, I've opened an issue on github but haven't gotten any replies. Is there a better way to get some eyes on this? Would anyone here mind taking a look?
https://github.com/energia/tivac-core/issues/41
Cheers
Sol

This is a start to a bigger project and will be expanded on.
Temperurature sensor for Mash -- MSP430, LM75B, possible other sensors, thermal couple. (working on code and proof of concept)
Temperurature sensor for fermentation -- TBD
Specific gravity sensor -- TBD
User Interface -- TBD
automation of pumps gas lines and equipment --
Requirements: Food safe, easily cleaned. probes and sensors sealed......
What I want is mash temp monitoring and logging to help me improve my brew days and procedure and maybe add a heater to keep the tempature stable during this time.
Yes this has all been done before, but I want a home built one and one customized to my equipment.

Hi,
At a previous project I turn on and off power to ST LIS3DH Accelerometer using a MOSFET Circuitry. This is so to make sure the I2C Sensor is not consuming current when not in use.
A colleague of mine designed to power a ST LSM303AGR from one of the MCU IO Pins. The MCU IO voltage is enough to power the ST LSM303AGR, so, should work. But, powering I2C Sensor from MCU IO Pins is not the usual way and new to me. Do you think that powering the ST LSM303AGR from one of the MCU IO Pin is okay or is not recommended?
Regards,
Markel

Hello,
I'm working on msp430fr4133 board and interface SHTC3 (SENSIRION) sensor.
I'm working on energia v.18 IDE.
I've library of SHTC3 sensor based library.this library perfectly working in Arduino board.
But same library and its example sht-detect not working in energia IDE.
When I refer SHTC3 compatible library file .h and .cpp. if I'm comparing datasheet and library files then in .cpp not mention any hex address e.g Reset,ID, measure, sleep, wake up.
So,I have a 2 queries : (i) How this file working in arduino without addresses ? (ii) How to make energia compatible code by using attached library ?
Please suggest me sample code for SHTC3 (SENSIRION).
PFA.
Thanks & Regards,
Pratik
arduino-sht-master.zip
Sensirion_Humidity_Sensors_SHTC3_Datasheet.pdf

Hello, everyone! Has anyone used the I2C display module with the TM4C123 Launchpad? I'm trying to use this code as a test, but I was not successful. The version of the library I am using is 1.2.1
I accept other suggestions for using the i2c display.
Thanks in advance!
The code:
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// Start the I2C address at 0x27 position
LiquidCrystal_I2C lcd(0x27,2,1,0,4,5,6,7,3, POSITIVE);
void setup()
{
lcd.begin (16,2);
}
void loop()
{
lcd.setCursor(0,0);
lcd.print("test line 1");
lcd.setCursor(1,1);
lcd.print("test line 2");
}
The error:
In file included from C:\Users\Marcos\Documents\Energia\libraries\LiquidCrystal\FastIO.cpp:32:0:
C:\Users\Marcos\Documents\Energia\libraries\LiquidCrystal\FastIO.h:38:52: fatal error: pins_arduino.h: No such file or directory
#include <pins_arduino.h> // pleasing sanguino core
^
compilation terminated.
exit status 1

Still new to embedded programming and I am trying to use the MMA8452 accelerometer (datasheet) on SparkFun's breakout board (link). I programmed SparkFun's example program (link) into the MSP430G2553 via Energia with no issues and plotted the serial data in Excel. However this data, for lack of a better word, was "noisy." There would be huge spikes in the data even though the device was sitting still. Sometimes the WHO_AM_I value would be reported incorrectly as well.
I found out the board shipped with 10k pull ups so I dropped them to the recommended 4.7k? resistors and the problem persisted. When I tried to investigate the SCL and SDA lines with my oscilloscope, the problem would disappear and the data would be a pristine flat line (as expected). That told me the scope probe capacitance was actually helping the circuit and rather than decrease resistance I should increase resistance. That seemed very counter intuitive to me, but I followed the data and changed pull ups to 15k. The problem disappeared and the data was clean. I was using short leads with and without a breadboard. The jumper to the Green LED was also removed from the SCL line.
Being required to have 15k pull ups on the I2C bus seems wrong to me especially since the datasheet recommends 4.7k. Am I missing something? I am not well versed in I2C and Freescale's tech support has been less than helpful. I did order a MMA8451 sample and swapped it on SparkFun's breakout board and had the same problem. So I know the problem was not specific to that MMA8452.
Other I2C devices (like the BQ32000) work fine.

Check the usual suspects:
Is the I²C bus initialised?
Wire.begin();
Does the I²C device run at 3.3V?
Otherwise, use a logic-level converter.
Are pull-ups installed?
Try 10, 4.7 or 2.2 kΩ for the SDA and SCL lines.
In case the LaunchPad provides multiple I²C ports, is the correct port selected?
Try
Wire.setModule(0); // or other port number
Wire.begin();
Still nothing?
Use a logic analyser to trace the signals on the I²C port.
(To be continued...)

Hi everyone.
I'm new to this forum and new to TI mcu. Planing to get a launchpad with msp430g2553
I have experience with atmegas, and arduino ide.
I have a project to have some sensors around with batteries and a central receiver to publish to internet, the will comunicate vía nrf24l01 which is a SPI device and in the array of sensors some of them are I2C.
As I see the description I2C and SPI share the pin in Msp430G2, so my question: is possible to use both in the same project in a reliable way?
I did this project with atmega328 and arduino ide but I read the msp430g2553 has better power efficiency and want to give it a try.

I'm trying to connect the HDC2010 temperature sensor to the MSP430FR5969 Launchpad.
I'm using the HDC2010 EVM, which consists of a MSP430F5528 (which handles USB communications to the GUI tool) and a HDC2010 (connected over I2C). The portion with the HDC2010 can be broken off from the main board in order to use it with another MCU.
I'm attempting to connect it to a MSP430FR5969 Launchpad which has the SHARP Memory LCD (uses SPI) connected to it. I couldn't find a ready made library for the HDC2010 & MSP430, so I copied over some code from the Arduino library.
To check whether I was using the HDC2010 correctly, I first used the following code (mostly taken from the HDC2010 lib) and used an Arduino Uno. I used MOSFET level translators (since the Arduino is 5V, HDC2010 is 3.3). I did not break off the HDC2010 section from the main board of the EVM, so the main MSP430F5528 was still connected to the HDC2010, but I guess it was idle.
#define ADDR 0x40
#include <Wire.h>
//Define Register Map
#define TEMP_LOW 0x00
#define TEMP_HIGH 0x01
#define HUMID_LOW 0x02
#define HUMID_HIGH 0x03
#define INTERRUPT_DRDY 0x04
#define TEMP_MAX 0x05
#define HUMID_MAX 0x06
#define INTERRUPT_CONFIG 0x07
#define TEMP_OFFSET_ADJUST 0x08
#define HUM_OFFSET_ADJUST 0x09
#define TEMP_THR_L 0x0A
#define TEMP_THR_H 0x0B
#define HUMID_THR_L 0x0C
#define HUMID_THR_H 0x0D
#define CONFIG 0x0E
#define MEASUREMENT_CONFIG 0x0F
#define MID_L 0xFC
#define MID_H 0xFD
#define DEVICE_ID_L 0xFE
#define DEVICE_ID_H 0xFF
float temperature = 0, humidity = 0;
void openReg(uint8_t reg)
{
Wire.beginTransmission(ADDR); // Connect to HDC2010
Wire.write(reg); // point to specified register
Wire.endTransmission(); // Relinquish bus control
}
uint8_t readReg(uint8_t reg)
{
openReg(reg);
uint8_t reading; // holds byte of read data
Wire.requestFrom(ADDR, 1); // Request 1 byte from open register
Wire.endTransmission(); // Relinquish bus control
if (1 <= Wire.available())
{
reading = (Wire.read()); // Read byte
}
return reading;
}
float readTemp(void)
{
uint8_t byte[2];
uint16_t temp;
byte[0] = readReg(TEMP_LOW);
byte[1] = readReg(TEMP_HIGH);
temp = (unsigned int)byte[1] << 8 | byte[0];
return (float)(temp) * 165 / 65536 - 40;
}
void writeReg(uint8_t reg, uint8_t data)
{
Wire.beginTransmission(ADDR); // Open Device
Wire.write(reg); // Point to register
Wire.write(data); // Write data to register
Wire.endTransmission(); // Relinquish bus control
}
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Wire.begin();
}
void loop() {
// put your main code here, to run repeatedly:
Serial.println(temperature = readTemp());
//Serial.println(humidity = readHumidity());
delay(1000);
}
This code worked and I got temperature readings.
Next, I tried it out on the MSP430FR5969, again, without breaking off the sensor from the mainboard. It didn't work at first, so I checked with a logic analyzer and if I recall correctly, either the SCK or SDA lines wasn't sending any data. However, after sometime it started working properly, and then stopped again.
After trying for a couple of hours, I decided to disconnect the HDC2010 from the mainboard, in case the MSP430F5528 was causing some issues. I connected the HDC2010 to the Arduino Uno via the logic level shifter, and the code worked correctly. However, it doesn't work with the MSP430FR5969. I tried out the inbuilt Wire examples, and the logic analyzer reveals that the I2C lines don't seem to be sending data at all (they work fine as GPIO).
I'm using pins 9 & 10 on a Rev2.0 launchpad. What's odd is that it worked for a little while & I cannot figure out what I'm doing wrong.
This is with a 1.2k ohm pull up on the clock line (2nd row). Without the pull up, the line remains low. The first row shows SDA, but the logic is inverted for some reason, and if I use a 10k pull up, it remains high continuously.
I managed to capture this when it worked correctly with the MSP430FR5969:
I've read conflicting reports about the actual I2C pins on the MSP430FR5969 launchpad: are they at 9 & 10 (as the board pdf & silkscreen says), or have they been shifted to the same pins as SPI?
What's the best way to debug this? Simple I2C sketches don't seem to work for some reason, but it worked correctly for a little while.

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

I have been trying to use a simple I2C sensor (LM75) with a MSP430FR5994. I find there are two pin maps. One at Energia (http://energia.nu/wordpress/wp-content/uploads/2016/11/Capture-2016-11-30-à-15.10.44.png) and one at TI directly (http://www.ti.com/lit/ml/slau677/slau677.pdf) on page 2. I have tried using I2C (1) as indicated at in the TI reference, and I have tried I2C (2) as indiicated in the Energia reference. neither one work. I can use an Arduino to access the sensor so I have some hope that this might work. What pins do I need to use to use I2C? Is there a library call to specify which I2C pins to use?
By the way, I can connect to the board and load the blink sample, and I can do serial communication, so board connectivity is OK, I2C is not.
Gerald

Hi, I'm having a lot of trouble figuring out how to communicate with this Adafruit 7-segment display.
I've looked through the Adafruit LED library, seen non-MSP microcontrollers working with the code, tried understanding the HT16K33 datasheet. I've even recorded the SCL and SDA signals from my Arduino connecting with the 7-segment. However, I'm still not sure how to get it to work with my MSP430G2553 or even how to get started. Though, I have looked into the MSP430 example code for i2c communications with the MSP430 as the master.
Is it as simple as just converting the Adafruit LED library from C++ to C?
I didn't expect interfacing with a 7-segment display to be so difficult for me.
Any advice is much appreciated.

Hello
it looks like I bumped into an issue which might be of interest, and needs to be investigated. I have a string of I2C devices running on i2C Bus on Arduino Mega (MCP4531 potti, LM-75 Temp sensor, 2x PCF 8575 I/Expanders). All running smooth. The next step I had to exchange the Mega with Tiva Stellaris Launchpad (EK-TM4C129E ), which I did, I havent changed anything on the setup besides the Mega2560 with Launchpad. While running the i2C scanner I saw, full Bus of devives. Furthermore I changed the i2C modules (0,1,2 with setModule()) nothing changed, same issue persists. Pull-ups varied from 1KOhm - 9Kohm, still same issue. Anyone experienced something like that before?

Hi,
I'm trying to make a clock with a Tiny RTC module and a iTead 5110 Nokia LCD. I'm using Adafruit RTClib and the energia LCD_5110_SPI.
Each library an device are working fine separately but when put together it stops working, is it possible to have SPI and I2C device working simultaneously?
Thanks.

Hello everyone,
I'm trying to use I2C0 on tm4c1294 to communicate with rtc ds1307/ am2315 but it doesn't work. I was tried read many threads about i2c issue on tiva c with no luck. Here are one of them:
Have anyone successful using I2C on tiva C (tm4c1294ncpdt)? Guide me, pls.

Hello,
What is the status of Wire.h when using energia with the tiva-c board? Since there is the BoardManager in E18, the file layout has changed. Which leads to some confusion.
eagle@daredevil:~$ find . -type f -name "Wire.h"
./.energia15/packages/energia/hardware/msp432/3.8.0/cores/msp432/ti/runtime/wiring/Wire.h
./.energia15/packages/energia/hardware/msp430/1.0.2/libraries/Wire/Wire.h
./.energia15/packages/energia/hardware/tivac/1.0.2/libraries/Wire/Wire.h
./.energia15/packages/energia/hardware/msp432r/5.6.0/cores/msp432r/ti/runtime/wiring/Wire.h
./bin/energia-1.6.10E18/hardware/energia/msp430/libraries/Wire/Wire.h
./bin/energia-1.6.10E18/hardware/energia/msp430/cores/msp430/Wire.h
So I think when using energia with tivac, it will use the .energia15/packages/energia/hardware/tivac/1.0.2/libraries/Wire/Wire.h file that is in the hidden .energia directory right?
Then I went ahead and edited the Wire.cpp file in the tivac/1.0.2 dir.
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <inttypes.h>
#include "wiring_private.h"
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "inc/hw_ints.h"
#include "inc/hw_i2c.h"
#include "driverlib/gpio.h"
#include "driverlib/debug.h"
#include "driverlib/interrupt.h"
#include "driverlib/rom.h"
#include "driverlib/rom_map.h"
#include "driverlib/pin_map.h"
#include "driverlib/sysctl.h"
#include "driverlib/i2c.h"
#include "Wire.h"
Here is a list of include files from Wire.cpp.
So here is my question: is this Wire.cpp implementation is for TM4C? is it using or based on the TivaWare Peripheal library?
I intend to make some modifications for it, for example using 2 i2c ports at the same time. So I need to start at the correct place.
Any ideas / help greatly reccomended.
Best regards,
CA

Hello again,
I am trying to connect up 2 MSP430FR4133 using the slave_sender and Master_reader examples in the energia given examples. There is no information about which pins to use but RXD and TXD are the only pins outputting on the scope so i have tried these pins. I have also tried connecting up the pins that say they are for SPI on the pin layout to no success. Any help would be greatly appreciated.
Kind regards,
Chris

Hi,
I just noticed an excessive consumption of ram by Wire on G2553 (I did not test on other µC) : 400 bytes !!
I took a look at Wire.h but can't find where this memory is used.
If anyone can confirm this and/or have an idea about this issue ?
Regards

So, this is partly for me, and partly for others who need a refresher, or just do not know how. But I will be making several post here over time on how to write very simply code, to do one thing, or another. These, used in conjunction with a shell script could be very useful / flexible. After several long talks with many people, including some here on these very forums. I've decided that using C, to communicate with hardware, or hardware interfaces is best as can be for many situations. However, when you need to run several tools all at once, and have output formatted in some fashion, or easily modified. Shell scripts are very good at that sort of thing.
Read from a real-time clock
This post I will make about reading from a real-time clock. I spent hours messing around code related to I2C communications, and could never get exactly what I wanted. Plus, I wanted something that output date / time that looked very similar to the date Linux command. This could definitely been done using a shell script, but code size would probably be a lot larger. Additionally, a shell script would very likely be a lot slower, as with a script, one would have to be calling external cmdline tools to perform various operations. This example code is very fast, and prints to screen immediately after issuing the command. Since this command is very simple, and only prints the formatted date / time to screen. This could very easily be called from a shell script, and formatted further if need be.
The real-time clock I'm using for this demonstration is a Maxim DS3232 real-time clock which is very accurate, and also very expensive compared to other real-time clocks. At $7 + US each, it's not cheap. I also had to write my own device tree overlay for this RTC, which strictly speaking is not necessary. One can set the device up from the command line manually as demonstrated for many different RTC's on the web. In fact, all the device tree overlay that I wrote does, is set all this automatically up at boot. As far as teh actual overlay it's self. All I did was modify an existing overlay from the "official" bb-overlays repo on github. https://github.com/beagleboard/bb.org-overlays/blob/master/src/arm/BB-RTC-01-00A0.dts
To look something like this:
/*
* Copyright (C) 2015 Robert Nelson <robertcnelson@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
/dts-v1/;
/plugin/;
#include <dt-bindings/board/am335x-bbw-bbb-base.h>
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/pinctrl/am33xx.h>
/ {
compatible = "ti,beaglebone", "ti,beaglebone-black", "ti,beaglebone-green";
/* identification */
part-number = "BB-RTC-01";
version = "00A0";
fragment@2 {
target = <&i2c2>;
__overlay__ {
status = "okay";
/* shut up DTC warnings */
#address-cells = <1>;
#size-cells = <0>;
/* MCP79410 RTC module */
rtc@68 {
compatible = "maxim,ds3232";
reg = <0x68>;
};
};
};
};
On our cape, the RTC is on bus I2C-2, which is already enabled by default for capemgr. The rest of the above just means that status is okay(load the device ), the kernel module to load is called "ds3232", and the device address on the bus is 0x68.
Now on to the actual C code for reading from /dev/rtc1:
#include <stdio.h>
#include <stdlib.h>
#include <linux/rtc.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
void display_date_time(void)
{
struct rtc_time rtc_tm;
int fd = open("/dev/rtc1", O_RDONLY);
if(fd == -1){
perror("/dev/rtc");
exit(errno);
}
/* Read the RTC time/date */
int retval = ioctl(fd, RTC_RD_TIME, &rtc_tm);
if (retval == -1) {
perror("ioctl");
exit(errno);
}
int d = rtc_tm.tm_mday;
int m = rtc_tm.tm_mon + 1;
int y = rtc_tm.tm_year + 1900;
const char *wdays[] = {"Sun","Mon","Tues","Wed","Thur","Fri","Sat"};
const char *mnths[] = {"Jan","Feb","Mar","Apr","May","June","July","Aug","Sept","Oct","Nov","Dec"};
int wday = (d += m < 3 ? y-- : y - 2, 23*m/9 + d + 4 + y/4- y/100 + y/400)%7;
fprintf(stdout, "%s %s %02d %02d:%02d:%02d %d UTC\n",
wdays[wday], mnths[rtc_tm.tm_mon], rtc_tm.tm_mday,
rtc_tm.tm_hour, rtc_tm.tm_min, rtc_tm.tm_sec, y);
}
int main( int argc, char **argv )
{
display_date_time();
return 0;
}
As one can see, most of this code is for formatting the output in a specific way. In this case, the output will look exactly like the output one might expect to see after issuing the command "date". However, this output is fixed to output the date / time in the UTC time zone. As for one of the projects I'm using this in is for devices spread out all over the US, in 3 different time zones, and we do not care so much what the local time zone of that system so much, as much as knowing a given time "standard". e.g. if something fails, and we need to tell a customer what failed, and what time it failed, we can, Then if we need to convert that time to their time zone, easy.
Notice that the read() is handled by ioctl(). . .
Output:
root@wgd:~/# gcc -Wall -o read_rtc read_rtc.c
root@wgd:~/# ./read_rtc
Tues May 09 23:08:49 2017 UTC