Jump to content
43oh

lilyhack

Members
  • Content Count

    30
  • Joined

  • Last visited

Posts posted by lilyhack

  1. I am building a control system (TM4C129/123) that generates many data. These data are sent back to a higher level controller (Raspberry Pi) through ZigBee.

     

    Now, instead of TI always sending the data, I want to change the system so that when Raspberry Pi request data, only then TI sends data. So that means storing those data until the data request come. The data can be lost after the power off. 

     

    How do I do that? I understand there is a limit to how long we can store the data depending on the size of the data. 

  2. If you are looking at using TivaWare driverlib API call then no need to install TivaWare since driverlib is already installed. You can simply include the headers for the functions you want to use and call the API's. Note that the current release has an outdated driverlib installation which will be updated in the near future. Regardless, you can use this driverlib to get started without issues.

     

    e.g.:

    #include <stdint.h>
    #include <stdbool.h>
    #include "driverlib/gpio.h"
    #include "inc/hw_gpio.h"
    
    void setup()
    {
      // put your setup code here, to run once:
      GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1);
    }
    
    void loop()
    {
      // put your main code here, to run repeatedly:
      GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1, GPIO_PIN_1);
      delay(100);
      GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1, 0);
      delay(100);
    }
    

    Robert

     

    @@Robert

    I am planning to use ADC functionalities. Is that part of driverlib?

  3. I am using the current sensor HO 10-P with my TM4C123 launchpad board.

     

    Essentially I have to connect the Vout pin to a GPIO, configure the GPIO as an ADC pin and then configure the ADC controller to read the Vout from the sensor. I will connect the Vout to PE2 (which is AIN2 and also a GPIO).

     

    Wondering how to configure this GPIO as an ADC and then read it? Can you show a sample code snippet?

  4. I have an XBee (S2C) connected to my Mac and another XBee connected to a TI microcontroller (TIVA-C129) communicating with each other - Mac as a coordinator and TI as a router.

    I can communicate between them, but on the TI side, I can't read the exact data that is coming in the serial port.

    On the Mac, I am running below python code that reads the incoming serial data through XBee and writes an acknowledgment.

    #!/usr/bin/python
    import serial
    
    ser = serial.Serial('/dev/tty.usbserial-A104IC2U', 9600)
    ack='A'
    
    while True:
    incoming = ser.readline().strip()
    if incoming != 'A':
    print '%s' % incoming
    ser.write('%s\n' % ack)

    On the TI side, I have below code

    int incomingByte = 0;
    
    void setup()
    {
    Serial3.begin(9600); //UART3 has XBee connection
    pinMode(LED, OUTPUT); 
    }
    
    void loop()
    {
    Serial3.println("Sending command to the XBee");
    delay(1000);
    Serial3.println("I am R1");
    delay(1000);
    
    if (Serial3.available() > 0) {
    // read the incoming byte from UART3
    incomingByte = Serial3.read();
    
    // say what you got, print at the usb serial console
    Serial.print("I received: "); 
    Serial.println(incomingByte, DEC);
    
    }
    
    }

    When I run this, XBee communication stops after printing "I am R1" in the python console. I am sure Serial3.available() > 0 is working as when I replace it with a blink code like below, it works and XBee communication keeps working on.

    if (Serial3.available() > 0) {
    
    digitalWrite(LED, HIGH); // turn the LED on (HIGH is the voltage level)
    delay(1000); // wait for a second
    digitalWrite(LED, LOW); // turn the LED off by making the voltage LOW
    delay(1000); // wait for a second
    }

    So looks like the problem is in

     

    incomingByte = Serial3.read();

     

    From python, I am sending a string (%s) with ser.write('%s\n' % ack). Is Serial3.read() the right read mechanism for the ack string? Anything else?

     

    FYI: I tested the serial.read() only with TI (no python involved) by writing something in the console and serial.read() can read and print it.

  5. I am planning to port this code for TIVA-C129 using Energia (on a Mac). 1st trying if it even compiles. I have below include

     

     

    #include "XBee.h"
    #include <SoftwareSerial.h>

    Getting error

     

    "#include <SoftwareSerial.h>

                                                ^

    compilation terminated."

     

    I even tried doing  #include "SoftwareSerial.h" but same error. What am I missing?

  6. I am using TM4C129 Launchpad launchpad and trying to connect XBee Series 2 (S2C) through UART. 

     

    Looking into the pinout of TM4C129, I am connecting like below

     

    XBee TX <---> RX (UART0)

     

    XBee RX <---> TX (UART0)

     

    XBee 3.3V <--->  pin#41

     

    XBee GND <---> pin#62 

     

    I use below code on the LaunchPad at Energia

     



    void setup()
    {
      Serial.begin(9600);
      //pinMode(13, OUTPUT);   
    }


    void loop()
    {
      Serial.println('H');
      delay(1000);
      Serial.println('L');
      delay(1000);
      
    }


     

    And the below python code runs on my Mac as a coordinator

     



    #!/usr/bin/python


    import serial


    ser = serial.Serial('/dev/tty.usbserial-A104IC2U', 9600)


    while True:
            incoming = ser.readline().strip()
            print '%s' % incoming


    But it doesn't work. FYI, this code worked on Arduino.

     

    Has anyone tried this before? Any suggestion?

    Am I missing some connection? jumper settings? Anything on the code?

  7. After installing Energia in Mac, what is the path for Energia Libraries?

    /Documments/Energia/libraries doesn't have anything.

     

     

    A quick Google search says the library path in Mac is /Applications/Energia.app/Contents/Resources/Java/hardware

     

    But I don't see any library folder for TIVA-C (TM4C129) there which is what I am using.

     

    The installation in Mac seems to  created different directory structure than Windows (I don't own a PC anymore). I am looking for TIVA-C Ethernet libraries installed while installing Energia.

     

    Any suggestion?

  8. I am using the WebClient example to connect to a service running on my local network on a raspberry pi.

     

    If I use IP address of the raspberry PI as the server, I can connect

     

    IPAddress server(192,168,46,70); // RPI

     

    But if I use char server[] = "http://raspberrypi.local"(.local name created through Avahi), the connection failed.

     

    Anybody else had this issue before? How did you revolve?

  9. I am using DhcpAddressPrinter example with M4C129 LaunchPad to generate IP address from Mac address.  It works in my home network but not in the office network.

     

    I get below message in my office network

     

    "Failed to configure Ethernet using DHCP"

     

    What am I missing?

  10. I am using TM4C129 LaunchPad for an Industrial IoT product. We want to have a web server running on it.


     


    I am looking into this example of setting up the IP address. To do it this way, every time you join a new network, you have to change the code for a different IP address. Is there a way to avoid this problem? Any example of how can I change the IP address automatically as soon as it joins a a new network? 


     


    I believe that the TivaWare provided example enet_io for the TM4C129x board does what I am looking for. But I would like an example in Energia. Can you please help?


×
×
  • Create New...