Jump to content

vim505

Members
  • Content Count

    5
  • Joined

  • Last visited

  1. Hi, I am trying to get the status from a I2C transmission. But the Wire.endTransmission() always returns a zero. It is not a problem of the wire library, because I can find the same problem using code composer studio using the TI compiler as well with the Gnu Compiler. On the osciloscope I can see that the Master sending, bit 9 has a nack, no bytes are send afterwards, so the cpu knows it isn'r right but the I2C Master Control/Status register only gives Idle(32), also ROM_I2CMasterErr returns a 0 I have tried: uint8_t sendTxData(unsigned long cmd, uint8_t data) { delayUs(10); uint8_t error; HWREG(I2C7_BASE + I2C_O_MCS) = cmd; ROM_I2CMasterDataPut(I2C7_BASE, data); while(ROM_I2CMasterBusy(I2C7_BASE); error=ROM_I2CMasterErr(I2C7_BASE); return(error); } this returns 0x20 (idle) and this uint8_t sendTxData(unsigned long cmd, uint8_t data) { delayUs(10); uint8_t error; HWREG(I2C7_BASE + I2C_O_MCS) = cmd; ROM_I2CMasterDataPut(I2C7_BASE, data); error=1; while(error & 0x01){ error= HWREG(I2C7_BASE + I2C_O_MCS) ; }; return(error); } this returns 0x20 (idle) and ofcourse: error=Wire.endTransmission() this returns 0 but there is no slave on that adress! (as also can be seen on the scoop) does any body have an idea. Or maybe a working I2C scanner for the connected lauchpad? cheers, John
  2. Hi L.R.A, Thanks for the help, I have got it working. cheers, John
  3. Hi Mr Cruz, I2c is not that tricky, I have done a lot of i2c on arduino, thing is the TM4C1294 has 8 separate I2c channels. So you have to tell energia what chanel to use. For this you use the setmodule command. Then you tell the master start communicating with the slave. The master starts by putting a clock and an adress on the sda and scl lines. And here is my problem on my oscciloscope I cannot see these signals, further more the software hangs trying to execute these commands. That brings me to the conclusion that there is something wrong inside the libraries. I am fully aware that things are somewhat new, but a basic I2C function should work in a release of energia. I don't want to start bitbanging when I have hardware I2c Fifo's. We should be going forward not back. cheers John
  4. Hi, I am trying to get i2c working on a EK-TM4C1294XL on energia. I am trying to use i2c channel 0. So they should be on pb2 and pb3. Thing is, I do not see any signal on sda or sck on the scope except for the pullup. On the serial debug I see "Start" and "Loop" but "Loop2" never appears. Like it is stuck sending I2c. As simpel as this program is, I am not getting it or something is wrong in the libraries. Hope you can help, cheers John #include <Wire.h> void setup() { Wire.setModule(0); Wire.begin(); // join i2c bus (address optional for master) Wire.setModule(0); Serial.begin(115200); // start serial communication at 9600bps pinMode(PC_7, OUTPUT); pinMode(PB_2, INPUT_PULLUP); pinMode(PB_3, INPUT_PULLUP); Serial.println("Start"); } void loop() { Serial.println("Loop"); Wire.beginTransmission(112); // transmit to device #112 (0x70) Wire.write(byte(0x00)); // sets register pointer to the command register (0x00) Wire.write(byte(0x50)); // command sensor to measure in "inches" (0x50) Wire.endTransmission(); // stop transmitting Serial.println("Loop2"); digitalWrite(PC_7,HIGH); // turn the LED on (HIGH is the voltage level) delay(250); // wait a bit since people have to read the output digitalWrite(PC_7, LOW); // turn the LED off by making the voltage LOW delay(250); // wait a bit since people have to read the output }
  5. Hi, I am trying to get i2c working on a EK-TM4C1294XL on energia. I am trying to user i2c channel 0. So they should be on pb2 and pb3. Thing is, I do not see any signal on sda or sck on the scope except for the pullup. On the serial debug I see "Start" and "Loop" but "Loop2" never appears. As simpel as this program is, I am not getting it or something is wrong in the libraries. Hope you can help, cheers John #include <Wire.h> void setup() { Wire.setModule(0); Wire.begin(); // join i2c bus (address optional for master) Wire.setModule(0); Serial.begin(115200); // start serial communication at 9600bps pinMode(PC_7, OUTPUT); pinMode(PB_2, INPUT_PULLUP); pinMode(PB_3, INPUT_PULLUP); Serial.println("Start"); } void loop() { Serial.println("Loop"); Wire.beginTransmission(112); // transmit to device #112 (0x70) Wire.write(byte(0x00)); // sets register pointer to the command register (0x00) Wire.write(byte(0x50)); // command sensor to measure in "inches" (0x50) Wire.endTransmission(); // stop transmitting Serial.println("Loop2"); digitalWrite(PC_7,HIGH); // turn the LED on (HIGH is the voltage level) delay(250); // wait a bit since people have to read the output digitalWrite(PC_7, LOW); // turn the LED off by making the voltage LOW delay(250); // wait a bit since people have to read the output }
×