Jump to content
43oh

ilpaso

Members
  • Content Count

    25
  • Joined

  • Last visited

Posts posted by ilpaso

  1. Hi zeke,

    thank you for your nice workaround and moral support. I'll try it but I think you've confused:

    - || and && ;

    - >= 10 and <=10; 

    - the delay is (10*5)=50 milliSeconds.

    does not matter

     

     

    In the WirelessControl example for AIR430Boost ETSI library there is this note:

     

      /**
       *  The radio transmitter and receiver cannot be operated at the same time.
       *  Wait until transmit completes before turning on the receiver. Please note
       *  that the radio is considered busy when it is transmitting.
       *
       *  WARNING: If busy is not checked between two successive radio operations
       *  receiverOn/transmit, the radio may not perform the specified task. The
       *  radio must be complete with the transmission before it can begin the next
       */
     
    This is the infamous routine:
    boolean A110x2500Radio::busy()
    {
      if (gDataTransmitting)
      {
        return true;
      }
      return false;
    }
    

    and this routine changes the gDataTransmitting variable

    void A110x2500Radio::gdo0Isr()
    {
      // Note: It is assumed that interrupts are disabled.
      
      // The GDO0 ISR will only look for the EOP edge. Therefore, if the radio
      // is not transmitting the EOP, it must be receiving an EOP signal.
      if (gDataTransmitting)
      {
        /**
         *  Note: GDO0 is issued prior to the transmitter being completely
         *  finished. The state machine will remain in TX_END until transmission
         *  completes. The following waits for TX_END to correct the hardware
         *  behavior.
         */ 
        while (CC1101GetMarcState(&gPhyInfo.cc1101) == eCC1101MarcStateTx_end);
        gDataTransmitting = false;
      }
      else
      {
        gDataReceived = true;
        readDataStream();
      }
      
      // Always go back to sleep.
      sleep();
    } 

    I do not know how the module works at a lower level.

    I hoped that the library would work because it was initially released by Anaren.

    Maybe something I'm wrong.

     

    Bye

  2. Hi energia,

    thank you for your reply.

    Sorry but I forgot to write the Energia release: 0101E0013 with AIR430BoostEuropeETSI library downloaded from github: https://github.com/energia/Energia/commit/55cbbdb792fd092813c5b79a610690f52c12c5d1.

    I think this is the library release you attached in the post.

     

    I'll try this evening to increase the timeout to 1000. I've tested the code with a delay(500) (the last delay in the loop cycle) and it works a bit better.

    I've seen the function "boolean A110x2500Radio::busy()"  in the library. It tests gDataTransmitting variable.

    Is this variable linked to interrupt at line GDO0? The signal raise up and falls down but interrupt doesn't see this change. Is this right?

     

    Thank you 

  3. Hello everyone!
    I meet a problem using Air Boosterpack on launchpad MSP430F5529.
     
    I'm trying to make a small sensor network, a star network. 1 gateway and 2 sensors.
    The gateway sends a SYNC command to broadcast address.
    Each sensor listens for a random time if someone is trasmitting, if not it sends a RTS (Request To Send) command to gateway. The gateway sends back a CTS (Clear To Send).
    Once the sensor receives the CTS it will send back the data to the gateway.
     
     
    Before each Rx or Tx operation I've put a "while(Radio.busy())" as written in all examples.
    Very often gateway or sensor freezes after sending the packet and never exit from the "while(Radio.busy())" cycle.
     
    Can anyone help me with this issue?
     
    Thank you
     
     
     
    Attached here there are the gateway and sensor firmware. Please find the string "//IT FREEZES HERE!!!!" in order to see where the code is blocked.
     
    SENSOR:
    #include <SPI.h>
    #include <AIR430BoostETSI.h>
    
    // -----------------------------------------------------------------------------
    /**
     *  Defines, enumerations, and structure definitions
     */
    
    #define ADDRESS_LOCAL     0x04
    #define ADDRESS_REMOTE    0x02
    
    // identify a set of type of data received/send (command in cordata struct)
    #define  SYNC 1
    #define  CTS  2
    #define  RTS  3
    #define  SET  4
    #define  DATA 5
    #define  ACK  7
    
    #define RLED P1_0
    #define GLED P4_7
    
    
    /**
     *  sPacket - packet format.
     */
    struct sPacket
    {
      uint8_t from;           // Local node address that message originated from
      uint8_t message[59];    // Local node message [MAX. 59 bytes]
    };
    
    // -----------------------------------------------------------------------------
    /**
     *  Global data
     */
    
    struct sPacket rxPacket, txPacket;
    int timeout = 300;
    
    
    void setup()
    {
      startled();
      // Setup serial for debug printing.
      Serial.begin(115200);
    
      Serial.print("SENSOR, address:");
      Serial.println(ADDRESS_LOCAL);
    
      // The radio library uses the SPI library internally, this call initializes
      // SPI/CSn and GDO0 lines. Also setup initial address, channel, and TX power.
      Radio.begin(ADDRESS_LOCAL, CHANNEL_1, POWER_MAX);
    
    }
    
    void loop()
    {
      blinkled(GLED, 1, 50);
    
      ///WAIT SYNC
      rxPacket.from=0;           // Local node address that message originated from
      memset(rxPacket.message,0,sizeof(rxPacket.message));
    
      while(Radio.busy()){
        Serial.println("BUSY RX SYNC^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
        delay(5);
      }
    
      if(Radio.receiverOn((unsigned char*)&rxPacket, sizeof(rxPacket), timeout) > 0)
      {
        if(Radio.getCrcBit()!=1)
        {
          return;
        }
      }
    
      if (rxPacket.message[0] != SYNC) {
        Serial.println("NO SYNC");
        return;
      }
      Serial.println("SYNC ARRIVED");
    
    
      //CARRIER SENSE
      rxPacket.from=0;           // Local node address that message originated from
      memset(rxPacket.message,0,sizeof(rxPacket.message));
    
      while(Radio.busy()){
        Serial.println("BUSY CARIER SENSE^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
        delay(5);
      }
    
      if(Radio.receiverOn((unsigned char*)&rxPacket, sizeof(rxPacket), 100+random(timeout)) > 0)
      {
        Serial.println("CARRIER BUSY ********************************************");
        return;
      }
      Serial.println("CARRIER FREE");
    
    
      ///RTS
      delay(20); //attesa per dare il tempo al gateway di andare in rx
      txPacket.from = ADDRESS_LOCAL;
      memset(txPacket.message, 0, sizeof(txPacket.message));
    
      txPacket.message [0] = 3;
      txPacket.message [1] = 1;
      txPacket.message [2] = 1;
      txPacket.message [3] = 1;
      Radio.transmit(ADDRESS_BROADCAST, (unsigned char*)&txPacket, sizeof(txPacket));
      Serial.println("SENT RTS");
    
      
    
      ///WAIT CTS
      rxPacket.from=0;           // Local node address that message originated from
      memset(rxPacket.message,0,sizeof(rxPacket.message));
    delay(80);
      while(Radio.busy()){
        Serial.println("BUSY RX CTS^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"); //IT FREEZES HERE!!!!
        delay(5);
      }
    
      if(Radio.receiverOn((unsigned char*)&rxPacket, sizeof(rxPacket), timeout) > 0)
      {
        if(Radio.getCrcBit()!=1)
        {
          Serial.println("NO CTS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
          return;
        }
      }
    
      if (rxPacket.message[0] == CTS) {
        Serial.println("CTS ARRIVED");
        Serial.println("");
        blinkled(RLED, 1, 50);
      }
      else Serial.println("ERROR RECEIVING CTS");
    
      delay(300);
    }
    
    void blinkled(uint8_t led, uint8_t time, uint8_t delayTime){
      for(int i=0; i<time; i++){
        digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
        delay(delayTime);
        digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
        delay(delayTime);     
      }
    }
    
    void startled(){
      pinMode(RLED, OUTPUT);
      pinMode(GLED, OUTPUT);
    }
    

    GATEWAY:

    #include <SPI.h>
    #include <AIR430BoostETSI.h>
    
    // -----------------------------------------------------------------------------
    /**
     *  Defines, enumerations, and structure definitions
     */
    
    #define ADDRESS_LOCAL     0x02
    
      // identify a set of type of data received/send (command in cordata struct)
    #define  SYNC 1
    #define  CTS  2
    #define  RTS  3
    #define  SET  4
    #define  DATA 5
    
    
    #define RLED P1_0
    #define GLED P4_7
    
    
    /**
     *  sPacket - packet format.
     */
    struct sPacket
    {
      uint8_t from;           // Local node address that message originated from
      uint8_t message[59];    // Local node message [MAX. 59 bytes]
    };
    
    // -----------------------------------------------------------------------------
    /**
     *  Global data
     */
    
    struct sPacket rxPacket, txPacket;
    int timeout = 300;
    
    void setup()
    {
      startled();
        // Setup serial for debug printing.
      Serial.begin(115200);
      
      Serial.print("GATEWAY, address:");
      Serial.println(ADDRESS_LOCAL);
      
      // The radio library uses the SPI library internally, this call initializes
      // SPI/CSn and GDO0 lines. Also setup initial address, channel, and TX power.
      Radio.begin(ADDRESS_LOCAL, CHANNEL_1, POWER_MAX);
    }
    
    void loop()
    {
      blinkled(GLED, 1, 50);
      
      ///SEND SYNC
      txPacket.from = ADDRESS_LOCAL;
      memset(txPacket.message, 0, sizeof(txPacket.message));
    
      txPacket.message [0] = SYNC;
      txPacket.message [1] = 1;
      txPacket.message [2] = 1;
      txPacket.message [3] = 1;
      while(Radio.busy()){
        Serial.println("BUSY TX SYNC^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
        delay(5);
      }
      Radio.transmit(ADDRESS_BROADCAST, (unsigned char*)&txPacket, sizeof(txPacket));
      Serial.println("SYNC SENT");
      
      delay(40);
      
      ///WAIT RTS
      rxPacket.from=0;           // Local node address that message originated from
      memset(rxPacket.message,0,sizeof(rxPacket.message));
    
      while(Radio.busy()){
        Serial.println("BUSY RX RTS^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"); //IT FREEZES HERE!!!!
        delay(5);
      }
    
      if(Radio.receiverOn((unsigned char*)&rxPacket, sizeof(rxPacket), timeout) > 0)
      {
        if(Radio.getCrcBit()!=1)
        {
          return;
        }
      }
    
      if (rxPacket.message[0] != RTS) {
        Serial.println("NO RTS");
        return;
      }
      Serial.print("RTS ARRIVED from: ");
      Serial.println(rxPacket.from);
      
    
    
      ///SEND CTS
      delay(20); //wait
      txPacket.from = ADDRESS_LOCAL;
      memset(txPacket.message, 0, sizeof(txPacket.message));
    
      txPacket.message [0] = CTS;
      txPacket.message [1] = 1;
      txPacket.message [2] = 1;
      txPacket.message [3] = 1;
      while(Radio.busy()){
        Serial.println("BUSY TX CTS^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
        delay(5);
      }
      Radio.transmit(rxPacket.from, (unsigned char*)&txPacket, sizeof(txPacket));
      Serial.println("CTS SENT");
      Serial.println("");
    
      delay(100);
    }
    
    void blinkled(uint8_t led, uint8_t time, uint8_t delayTime){
      for(int i=0; i<time; i++){
        digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
        delay(delayTime);
        digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
        delay(delayTime);     
      }
    }
    
    void startled(){
      pinMode(RLED, OUTPUT);
      pinMode(GLED, OUTPUT);
    }
    

     

  4. Hi,

    I'm looking for an Energia library to use with msp430F5529 (or MSP430G2553) and ethernet boosterpack from RobG: http://forum.43oh.com/topic/4490-ethernet-booster-pack-v3/

     

    I've tried this one (http://forum.43oh.com/topic/4154-energia-library-ethernet-using-wiz820io/) but the compiler returns a lot of errors.

    I've found the code at this post (http://forum.43oh.com/topic/4490-ethernet-booster-pack-v3/?p=46637) but I'm not able to run it in Energia.

     

    Second question: why is not easy to use the Ethernet library from Arduino?

     

    Thank you

  5. Hi grahamf72

     

    with your example and the following code for setup method the current is between 3.5uA / 4.0uA. That is fantastic!

    I don't understand if something is wrong or the problem is my low cost meter.

    My Vcc is 3.3V. What is your test Vcc value in order to read a 0.1uA in LPM4?

    Xout and Xin pins are floating on launchpad. Is this correct for very low power layout?

    void setup()
    {
      pinMode(P1_1,INPUT_PULLDOWN);  
      pinMode(P1_2,INPUT_PULLDOWN);  
      pinMode(P1_3,INPUT_PULLDOWN);
      pinMode(P1_4,INPUT_PULLDOWN);  
      pinMode(P1_5,INPUT_PULLDOWN);  
      pinMode(P1_6,INPUT_PULLDOWN);  
      pinMode(P1_7,INPUT_PULLDOWN);  
      
      pinMode(P2_0,INPUT_PULLDOWN);
      pinMode(P2_1,INPUT_PULLDOWN);
      pinMode(P2_2,INPUT_PULLDOWN);
      pinMode(P2_3,INPUT_PULLDOWN);
      pinMode(P2_4,INPUT_PULLDOWN);
      pinMode(P2_5,INPUT_PULLDOWN);
      
      
      pinMode(P1_0,OUTPUT);       //Enable output on P1_0 (onboard red LED)
      attachInterrupt(P1_3,Interrupt, FALLING); //attach our interrupt routine to P1_3
    }
    
  6. Hi,

    I'm newbie in low power mode.

    I've seen a lot of examples but I'm not able to see a low current in LMP4 mode.

    The lowest current I can see is about 90uA.

     

    Is there a minimal working sketch in order to run LPM4 mode and wake up the microcontroller with an external interrupt and switch on a led?

    My hardware is launchpad V1.5 with Msp430G2553. Both red an green leds are off.

    I've removed all the jumpers (Vcc and uart, NOT rst and test) and my power supply is a battery at 3.5V.

     

    Thank you for your help and sorry for this newbie question.

     

     

     

     

  7. Hi,

    After some months of launchpad experiences I'm developing my first stand alone board.

     

    On the board there are these smd components for now.

    MSP430G2553 Tsop28pins

    Voltage regulator at 3,3V

    Anaren RF module.

    A led with 150ohm resistor.

     

    I think I've a problem with the sturtup and reset.

    There are 2 decoupling ceramics capacitors for the voltage regulator (about 4,7uF)

    There is a 100nF capacitor connected ad VCC and GND 10mm far from the microcontroller.

    There is a 47K resistor between Vcc and the RESET pin.

     

     

    Often if I connect the battery (nominal 3.7V) the circuit works well but it is not stable.

    Often it doesn't start.

     

    Sometimes when it doesn't work there is a 1V across the 47K resistor. If I decrease the resistor value it works better but there are the same problems.

     

     

    I tried to remove the RF module and write a simple led blink program (I use Energia IDE) but the problems are the same.

     

    Thank you for your help.

     

    ilpaso

     

     

     

     

  8. Hi all,

    @semicolo: Thanks a lot for the code.

     

    but if the the voltage is < 3V i think it can't read the value because it needs a 1.5V reference.

    The code in the first post is quite ok.

    I think I need only to reset an ADC register in order to restart in a clean state. But I don't know what I've to reset.

  9. hi,

    I've a msp430g2253 board powered by a battery. I'd like to read the voltage of the battery.

    I've found a function online (http://blog.elevendroids.com/2013/06/code-recipe-reading-msp430-power-supply-voltage-level/).

    uint16_t Msp430_GetSupplyVoltage(void)
    {
    	uint16_t raw_value;
    	// first attempt - measure Vcc/2 with 1.5V reference (Vcc < 3V )
    	ADC10CTL0 = SREF_1 | REFON | ADC10SHT_2 | ADC10SR | ADC10ON;
    	ADC10CTL1 = INCH_11 | SHS_0 | ADC10DIV_0 | ADC10SSEL_0;
    	// start conversion and wait for it
    	ADC10CTL0 |= ENC | ADC10SC;
    	while (ADC10CTL1 & ADC10BUSY) ;
    	// stop conversion and turn off ADC
    	ADC10CTL0 &= ~ENC;
    	ADC10CTL0 &= ~(ADC10IFG | ADC10ON | REFON);
    	raw_value = ADC10MEM;
    	// check for overflow
    	if (raw_value == 0x3ff) {
    		// switch range - use 2.5V reference (Vcc >= 3V)
    		ADC10CTL0 = SREF_1 | REF2_5V | REFON | ADC10SHT_2 | ADC10SR | ADC10ON;
    		// start conversion and wait for it
    		ADC10CTL0 |= ENC | ADC10SC;
    		while (ADC10CTL1 & ADC10BUSY) ;
    		raw_value = ADC10MEM;
    		// end conversion and turn off ADC
    		ADC10CTL0 &= ~ENC;
    		ADC10CTL0 &= ~(ADC10IFG | ADC10ON | REFON);
    		// convert value to mV
    		return ((uint32_t)raw_value * 5000) / 1024;
    	} else
    		return ((uint32_t)raw_value * 3000) / 1024;
    }
    

    It works but the first time I call the function it uses the 1.5V reference (Vcc < 3V ) and the second time it uses 2.5V reference (Vcc >= 3V).

    The real voltage is 3,12V

    What is wrong?

    Thank you in advance.

     

    Regards

     

    ilpaso

     

  10. Hi Rei Vilo,

    Now it works with 4.7K pull-up risistors and the arduino sketch provided by Sparkfun (https://www.sparkfun.com/products/10530).

    It also works with your library "software I2C" in pins P2_3 and P2_4.

     

    I've only a problem: The magnetometer sends 6 bytes and this is the code:

     Wire.requestFrom(address, 6);
      if(6<=Wire.available()){
        x = Wire.receive()<<8; //X msb
        x |= Wire.receive(); //X lsb
        z = Wire.receive()<<8; //Z msb
        z |= Wire.receive(); //Z lsb
        y = Wire.receive()<<8; //Y msb
        y |= Wire.receive(); //Y lsb
      }
    

    If I use the I2C software library it loses the last byte ("Y lsb").

    If I change the first line of this code to "Wire.requestFrom(address, 7);" it works.

    Maybe is there a little bug in the library?

     

    Thank you

     

    ilpaso

  11. Hi Rei Vilo,

     

    thank you for your reply!

    I've already read these threads.

    These are my feedbacks.

    1) With external pull-up (10K) resistors it doesn't work.

    2) I changed the twi.c file and it doesn't work.

     

    It's strange because each of these threads has a different solution.

     

    Regards

     

    ilpaso

  12. Hi,

    I'm new with Energia but not with Arduino.

    I'm not able to communicate with HMC5883L throw I2C. The board is launchpad with msp430g2553 microcontroller.

     

    I read some threads about this issue but I didn't find a solution.

    #include <Wire.h>#define address 0x1E //0011110b, I2C 7bit address of HMC5883void setup(){  Serial.begin(9600);  // start serial for output  Wire.begin();        // join i2c bus (address optional for master)  //Put the HMC5883 IC into the correct operating mode  Wire.beginTransmission(address); //open communication with HMC5883  //Write CRA (00) 
×
×
  • Create New...