Quantcast
Channel: MSP low-power microcontroller forum - Recent Threads
Viewing all 21927 articles
Browse latest View live

MSP432 eUSCI I²C UCBCNTx stuck at UCBxTBCNT value in receiver mode

$
0
0

Hello world,

I've a problem with my MSP432P401R that I don't understand. I have configured the eUSCI register for I²C in master mode to send and receive data, all works well, except in receiver mode when i read the UCBCNTx field in UCBxSTATW register, this not return the number of bytes received on I²C bus since the last START or RESTART as it's indicate in the Technical Reference Manual p802, but always the value of UCTBCNRx field in UCBxTBCNT register that i have previously indicate. Whereas in transmitter mode all works perfectly. Can someone help me to understand this problem?

here is my code:

/******************************************************************************/
/*        @TITRE : i2c.h                                                      */
/*      @VERSION : 0                                                          */
/*     @CREATION : august 20, 2016                                            */
/* @MODIFICATION :                                                            */
/*      @AUTEURS : Enzo IGLESIS                                               */
/*    @COPYRIGHT : Copyright (c) 2016 Enzo IGLESIS                            */
/*      @LICENSE : MIT License (MIT)                                          */
/******************************************************************************/

#ifndef I2C_H_
#define I2C_H_

/******************************************************************************
 *
 *                                /|\  /|\
 *                MSP432P401       R    R
 *                  master         |    |
 *             -----------------   |    |
 *            |     P1.6/UCB0SDA|<-|----+->
 *            |                 |  |
 *            |                 |  |
 *            |     P1.7/UCB0SCL|<-+------>
 *            |                 |
 *
 *****************************************************************************/

/*******************************    LIBRARYS    *******************************/

/*******************************     MACROS     *******************************/
#define I2C_R   (!0)    /* Read */
#define I2C_W   (0)     /* Write */

#define I2C_ERR     (-1)

#define i2c_start()                 (UCB0CTLW0 |= UCTXSTT)
#define i2c_stop()                  (UCB0CTLW0 |= UCTXSTP)
#define i2c_start_stop();           (UCB0CTLW0 |= (UCTXSTT|UCTXSTP))
#define i2c_start_is_sent()         (UCB0CTLW0&UCTXSTT)
#define i2c_stop_is_sent()          (UCB0CTLW0&UCTXSTP)
#define i2c_bus_busy()              (UCB0STATW&UCBBUSY)


/*******************************     TYPES      *******************************/

/*******************************   CONSTANTES   *******************************/

/*******************************    VARIABLES   *******************************/

/*******************************   FUNCTIONS    *******************************/
void i2c_frequency(int_least32_t scl_frequency);
void i2c_setup_device(void);
void i2c_bytes_to_process(uint8_t counter);
void i2c_slave_address(uint8_t address, uint8_t r_w);
int i2c_status(void);
int i2c_read_write(uint8_t r_w, uint8_t address, uint8_t * data, uint8_t length);
int i2c_write(uint8_t address, uint8_t * data, uint8_t length);
int i2c_read(uint8_t address, uint8_t * data, uint8_t length);

#endif

/******************************************************************************/
/*        @TITRE : i2c.c                                                      */
/*      @VERSION : 0                                                          */
/*     @CREATION : august 20, 2016                                            */
/* @MODIFICATION :                                                            */
/*      @AUTEURS : Enzo IGLESIS                                               */
/*    @COPYRIGHT : Copyright (c) 2016 Enzo IGLESIS                            */
/*      @LICENSE : MIT License (MIT)                                          */
/******************************************************************************/

/*******************************    LIBRARYS    *******************************/
#include <msp432p401r.h>
#include "i2c.h"
/*******************************     MACROS     *******************************/

/*******************************     TYPES      *******************************/

/*******************************   CONSTANTES   *******************************/

/*******************************   VARIABLES    *******************************/
/* IRQHandler */
static volatile uint8_t * rtx_data;
static volatile int8_t status;
/*******************************   FUNCTIONS    *******************************/
void i2c_enable_interrupt(void)
{
	UCB0IE |= UCBCNTIE;         /* Byte counter interrupt enable */
	UCB0IE |= UCNACKIE;         /* Not-acknowledge interrupt enable */
	UCB0IE |= UCTXIE0;          /* Transmit interrupt enable 0 */
	UCB0IE |= UCRXIE0;          /* Receive interrupt enable 0 */
	NVIC_EnableIRQ(EUSCIB0_IRQn);
}

void i2c_frequency(int_least32_t scl_frequency)
{
    UCB0CTLW0 |= UCSWRST;        /* Software reset enable */
    UCB0BRW = SystemCoreClock/scl_frequency;  /* prescale */
    UCB0CTLW0 &= ~UCSWRST;      /* Software reset released for operation */
    i2c_enable_interrupt();
}

void i2c_setup_device(void)
{
	/* Set UCSWRST */
	UCB0CTLW0 = UCSWRST;        /* Software reset enable */
	/* initialize eUSCI_B register */
    UCB0CTLW0 &= ~UCA10;        /* Own address is a 7-bit address */
    UCB0CTLW0 &= ~UCSLA10;      /* Address slave with 7-bit address */
    UCB0CTLW0 &= ~UCMM;         /* Single master environment. There is no other master in the system. The address compare unit is disabled */
    UCB0CTLW0 |= UCMST;         /* Master mode */
    UCB0CTLW0 |= UCMODE_3;      /* I2C mode */
    UCB0CTLW0 |= UCSYNC;        /* Synchronous mode enable */
    UCB0CTLW0 |= UCSSEL_3;      /* clock source : SMCLK */
    UCB0CTLW0 &= ~UCTXACK;      /* (slave mode) Do not acknowledge the slave address */
    UCB0CTLW0 |= UCTR;          /* Transmitter */
    UCB0CTLW0 &= ~UCTXSTP;      /* No STOP generated */
    UCB0CTLW0 &= ~UCTXSTT;      /* Do not generate START condition */
    UCB0CTLW0 &= ~UCTXNACK;     /* Acknowledge normally */
    UCB0CTLW1 = 0x0000;			/* Reset UCB0CTLW1 */
    UCB0CTLW1 &= ~UCETXINT;     /* (slave mode) UCTXIFGx is set after an address match with UCxI2COAx and the direction bit indicating slave transmit */
    UCB0CTLW1 &= ~UCCLTO_3;     /* Disable clock low timeout counter */
    UCB0CTLW1 &= ~UCSTPNACK;    /* Send a not acknowledge before the STOP condition as a master receiver */
    UCB0CTLW1 &= ~UCSWACK;      /* The address acknowledge of the slave is controlled by the eUSCI_B module */
    UCB0CTLW1 |= UCASTP_2;      /* A STOP condition is generated automatically after the byte counter value reached UCBxTBCNT */
    UCB0CTLW1 |= UCGLIT_0;      /* Deglitch time = 50 ns */
    UCB0ADDMASK |= ADDMASK_M;   /* the address mask feature is desactivated */
    UCB0I2COA0 &= ~UCGCEN;      /* Do not respond to a general call */
    UCB0I2COA0 &= ~UCOAEN;      /* The slave address defined in I2COA0 is disabled */
    UCB0I2COA1 &= ~UCOAEN;      /* The slave address defined in I2COA1 is disabled */
    UCB0I2COA2 &= ~UCOAEN;      /* The slave address defined in I2COA2 is disabled */
    UCB0I2COA3 &= ~UCOAEN;      /* The slave address defined in I2COA3 is disabled */
    /* Configure ports */
    P1SEL0 |= BIT6;				/* Configure P1.6 as SDA */
    P1SEL1 &= ~BIT6;
    P1SEL0 |= BIT7;				/* Configure P1.7 as SCL */
    P1SEL1 &= ~BIT7;
    /* Reset UCSWRST */
    UCB0CTLW0 &= ~UCSWRST;      /* Software reset released for operation */
    /* Enable interrupts */
    i2c_enable_interrupt();
}

void i2c_bytes_to_process(uint8_t counter)
{
    UCB0CTLW0 |= UCSWRST;       /* Software reset enable */
    UCB0TBCNT &= ~UCTBCNT_M;    /* reset Counter Threshold Register */
    UCB0TBCNT |= counter;       /* set Counter Threshold Register */
    UCB0CTLW0 &= ~UCSWRST;      /* Software reset released for operation */
    i2c_enable_interrupt();
}

void i2c_slave_address(uint8_t address, uint8_t r_w)
{
    UCB0I2CSA &= ~I2CSA_M;  /* Reset Slave Address Register */
    UCB0I2CSA |= address;   /* I2C slave address */
    if(r_w) /* read */
    {
        UCB0CTLW0 &= ~UCTR; /* Receiver */
    }
    else    /* write */
    {
        UCB0CTLW0 |= UCTR;  /* Transmitter */
    }
}

int i2c_status(void)
{
    /* local declaration */
    int8_t old_status = status;
    /* program statement */
    status = 0;
    return old_status;
}

int i2c_read_write(uint8_t r_w, uint8_t address, uint8_t * data, uint8_t length)
{
    while(i2c_bus_busy());  /* Wait until i2c bus is available */
    rtx_data = data;
    status = 0;
    i2c_bytes_to_process(length);   /* set the number of bytes to send */
    i2c_slave_address(address, r_w);  /* set the slave address in write or read mode */
    i2c_start();    /* send an i2c start signal */
    /* IRQHandler */
    __sleep();
    return i2c_status();    /* return the number of bytes processed or -1 if an error occured */
}

int i2c_write(uint8_t address, uint8_t * data, uint8_t length)
{
    return i2c_read_write(I2C_W, address, data, length);
}

int i2c_read(uint8_t address, uint8_t * data, uint8_t length)
{
    return i2c_read_write(I2C_R, address, data, length);
}

/*******************************   INTERRUPT    *******************************/
void EUSCIB0_IRQHandler(void)
{
    if(UCB0IFG&UCTXIFG0)	/* transmit */
    {
        UCB0TXBUF = rtx_data[(UCB0STATW&UCBCNT_M)>>UCBCNT_OFS];    // Here it's incremented
	UCB0IFG &= ~UCTXIFG0;
    }
    if(UCB0IFG&UCRXIFG0)	/* receive */
    {
        UCB0IFG &= ~UCRXIFG0;
	rtx_data[(UCB0STATW&UCBCNT_M)>>UCBCNT_OFS] = UCB0RXBUF;    // Here it's stuck at the number of byte to process
    }
    if(UCB0IFG&UCNACKIFG)	/* Not-acknowledge received */
    {
    	UCB0IFG &= ~UCNACKIFG;
    	i2c_stop();             /* I2C Stop condition */
    	status = I2C_ERR;
    	__low_power_mode_off_on_exit()
    }
    if(UCB0IFG&UCBCNTIFG)	/* Byte counter */
    {
 	UCB0IFG &= ~UCBCNTIFG;
        status = UCB0TBCNT&UCTBCNT_M;
	__low_power_mode_off_on_exit();
    }
}


PUSH.B X(SP) stores bad value when hit by DMA and interrupt on MSP430F2618

$
0
0

Hi,


I believe I found a bug in MSP430F2618.


In our application the IAR compiler uses PUSH.B X(SP) to pass a local variable to a function.
The application also uses byte->byte DMA transfer for doing SPI tranfers.

Occasionally, the parameter is pushed as 0xff although the variable is 0.

I have build and attached a minimal test case.

It seems that the error goes away when DMAONFETCH is set. For our application this is an acceptable workaround.

Could you please confirm:

  • that the error exists
  • that DMAONFETCH really makes the error goes away

Thanks in advance

  Jan-Hinnerk Dumjahn(Please visit the site to view this file)

Begginer in microcontroller field

$
0
0

Hi'

I'm using a MSP430F5131IDA microcontroller and CCS for the IDE.

i need to generate a one pulse per second from port 2 pin 4 (P2.4). how do i do that using the CCS program ? and what devices do i need in order to download the program to the microcontroller?

p.s.

Where can i get full information on how to program the microcontroller using CCS?

thanks in advance.

BSL question on MSP430FR6972

$
0
0

Part:  MSP430FR6972.   Project:  BSL

We are using our standard serial (Host) interface that we’ve used for every product for bootstrap loading through the serial datacom port. 

We have patched this interface into the MSP430FR6972 TXD and RXD BSL pins, P2.0 and P2.1 respectively using the MSP-TS430PM64F Target Socket board.  

For the Target socket, we do not have anything plugged into the JTAG or BSL connectors. The jumper settings are as follows

  • J1 -> 1-2 shorted
  • JP1 -> closed
  • JP2 -> closed
  • JP3 -> 2-3 (UART)
  • JP4 to JP8 -> 2-3 (4-wire JTAG mode)
  • JP9 -> closed
  • JP13 -> open
  • JP14 -> closed
  • JP15 -> closed
  • JP16 -> 2-3 shorted (UART)
  • JP17 and JP18 -> open

We use RTS/DTR from the host to provide the /RST and TEST signals required for the BSL entry sequence.  

It seems that we satisfy the requirements as depicted in the Bootloader User’s Guide.  However, when attempting to send a “Change Baud Rate command about 550ms after /RST goes back HIGH (when TEST is HIGH), but we never get any response from the MSP430.

Note we are able to communicate to and from the MSP430FR6962 when the application code is running, but for some reason either the BSL sequence is not working or the processor is not responding if it is indeed in bootloader mode.

Can you help?  Is there something else that could interfere with the MSP430 from entering the bootloader program? 

Here are some additional notes:

  1. We are using 9600, E, 8, 1 when communicating to the BSL and we assume it uses the same 5xx/6xx BSL protocol as the ‘5436A.
  2. TEST pulse (high level) meets duration based on tSBW,EN parameter .
  3. Modified the BSL entry sequence to mimic exact sequence as depicted in Figure 2 in the FR69xx bootloader user’s guide. (we removed the 1st 2 pulses as depicted in the original BSL plot attached)
  4. The supply voltage, VCC does not drop below its threshold during the sequence. 

The only other question, is that I’m not exactly sure what it means by “JTAG has control over the MSP430’s resources” based on the statement below. 

Therefore, can you ask if there is anything specific about the JTAG interface and/or state of the I/O pins (i.e. TDI, TCK, TDO, TEST, etc.?) that dictates to the ‘FR6972 that JTAG has control and BSL will not be allowed?

 

 

 

Using GCC C++ cannot resolve ambiguity between fixed with uint and unsigned.

$
0
0

I get the following error:

/home/sporty/HydroGuardFW/hw_1_5/miwt_os/sensor/transient_sensor.h|148 col 32| error: call of overloaded 'push_str(unsigned int)' is ambiguous
||          out.push_str(data.len());
||                                 ^
/home/sporty/HydroGuardFW/hw_1_5/miwt_os/dispatcher/array_safe.h|816 col 6| note: candidate: bool Array_s<T>::push_str(char) [with T = char]
||  bool Array_s<char>::push_str(char x);
||       ^
/home/sporty/HydroGuardFW/hw_1_5/miwt_os/dispatcher/array_safe.h|822 col 6| note: candidate: bool Array_s<T>::push_str(uint8_t) [with T = char; uint8_t = unsigned char]
||  bool Array_s<char>::push_str(uint8_t x);
||       ^
/home/sporty/HydroGuardFW/hw_1_5/miwt_os/dispatcher/array_safe.h|828 col 6| note: candidate: bool Array_s<T>::push_str(uint16_t) [with T = char; uint16_t = short unsigned int]
||  bool Array_s<char>::push_str(uint16_t x);
||       ^
/home/sporty/HydroGuardFW/hw_1_5/miwt_os/dispatcher/array_safe.h|834 col 6| note: candidate: bool Array_s<T>::push_str(uint32_t) [with T = char; uint32_t = long unsigned int]
||  bool Array_s<char>::push_str(uint32_t x);
||       ^
|| /home/sporty/HydroGuardFW/hw_1_5/miwt_os/dispatcher/array_safe.h: In instantiation of 'bool Array_s<T>::print(SerialTXInterface*) [with T = unsigned int]':

The TI C/C++ compiler as well as the Linux GCC compiler does not generate the same error, this is probably an issue with the stdint.h for the GCC compiler.  Is there a a recommended workaround?

MSP430F5152 Power Consumption

$
0
0

CPU: MSP430F5152

MCLK: 25MHz

Power supply voltage: 5V

When code running at unlimited loop: while(1) { } The system power consumption is 2.8mA

When code running at unlimited loop:

while (1)

{

  if(anything != 0) anything = 1;

}

The system power consumption is 5.2mA.

If there is anything except empty in the unlimited loop, the power consumption

will be 5.2mA. Are there anyone tell me the reason? If it is empty in loop, the power consumption is 2.8mA.

Thank you in advance!

MSP430F2619 - Disabling CPU causes 32kHz Crystal to drop out

$
0
0

Hi All,

I am trying to use LPM2 with my application and I am having some trouble with my 32 kHz crystal. In my setup I am using the DCO to drive MCLK, and SMCLK at 16 MHz. I am using my 32 kHz crystal to source ACLK from the LFXT1 input.

I fire a 16138 kHz timer off of the ACLK input, and when I put my device to sleep, it wakes up off that timer. However.. when I disable the CPU, my crystal drops out. I looked at my crystal output on an OScope, and when the CPU is disabled, the output appears to have some kind of loading effect. Has anyone seen anything like this before?

I know that this only occurs if I disable the CPU, if I set SCG0 and SCG1 bits, the crystal behaves fine, its just when I set the CPU off bit that everything goes haywire.

Thanks,

Warren

Getting started with the MSP-EXP430G2

$
0
0

Hello I recently purchased a MSP-EXP430G2 Launchpad. I have been using CCS V6.1.1 with the F28M36. I need a simpler chip for my current projects and the MSP430 seems to meet my needs and allows me to continue using CCS with TFS.

I am having issues getting the basic blink led to run. I keep getting a "Error initializing emulator: No USB FET was found" Solved wrong driver it needs "MSP Debug Interface"

I have searched the forum and watched some videos on line and have yet to find an answer some posts are quite old....

I did not originally have the MSP430 device installed with CCS, I have run installation again and added those tools.

I even tried the Cloud version with no success.

Questions:

 When I look at Device Manager I see MSP-430F5438 USB. What is the correct one? Answer : "MSP Debug Interface" I had to select this manually.

This made the Cloud IDE work on a Windows 10 machine.

On my primary Windows 7 64-bit machine nothing works....

The desktop version has moved on to another issue.

If I follow this video (looks like a TI video)

https://www.youtube.com/watch?v=JfXz3x1tQFA 


I get this message:

Message box title Launching Debug Session

Load program Error.

File: C:\Source\MSP430\TestProject\test\Debug\test.out: Load failed.

Console:

MSP430: Trouble Writing Memory Block at 0xc000 on Page 0 of Length 0x1de: Read timed out

MSP430: File Loader: Verification failed: Target failed to write 0xC000

MSP430: GEL: File: C:\Source\MSP430\TestProject\test\Debug\test.out: Load failed.


Port settings are 9600, 8, None, 1, None

The Cloud running the same code gives this error:

Unable to connect to Launchpad w/ msp430g2553 (16MHz).

Please unplug and re-plug the USB connection and try again.

TI MSP430 USB/MSP430

Error Initializing emulator:No USB FET was found

I am more focused on using thestandard desktop version any help would be appreciated.


Can MSP432 UART support baud rate up to 921600?

$
0
0

Dear Experts

Can MSP432 UART support baud rate up to 921600?

Somehow I didn't see the UART baud rate data in the datasheet.

Thanks for your comment.

Delay calculation problem,when i use SMCLK=MCLK=Default DCO= 1.048576MHZ. when i toggle portline with 1000 counts i should get 0.957micro seconds but i am getting 21.5ms.Is there any clock divider?

$
0
0

Dear friends,

Delay calculation problem,when i use SMCLK=MCLK=Default DCO= 1.048576MHZ. when i toggle portline with 1000 counts i should get 0.957micro seconds but i am getting 21.5ms.Is there any clock divider please help me guys

Regards

Beeresh

cc110l with g2553

$
0
0

Dear sir,

I want to send the a characters from transmitter which is dynamically(means when i  type character in serial monitor ),transmitter has to take that character and has to send to receiver at the other end.

so for this where should i change my code.I am doing code in energia.

/**
 *  ----------------------------------------------------------------------------
 *  WirelessMonitorSensor.ino - wireless monitor sensor sketch using AIR430Boost ETSI driver.
 *  Copyright (C) 2012-2013 Anaren Microwave, Inc.
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License as published by the Free Software Foundation; either
 *  version 2.1 of the License, or (at your option) any later version.
 * 
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 * 
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 *
 *  This example demonstrates usage of the AIR430BoostETSI library which uses
 *  the 430Boost-CC110L AIR Module BoosterPack created by Anaren Microwave, Inc.
 *  and available through the TI eStore, for the European Union.
 *
 *  ----------------------------------------------------------------------------
 *
 *  Note: This file is part of AIR430Boost.
 *
 *  ----------------------------------------------------------------------------
 *
 *  Description
 *  ===========
 *
 *  Acts as a simple transmitter for a star network. The sensor node can 
 *  transmit any type of message one-way using the broadcast address. To create
 *  multiple networks, simply change the address on the hub node and have the
 *  nodes in that network transmit to the assigned hub address.
 *
 *  ----------------------------------------------------------------------------
 * 
 *  This example assumes that two BoosterPacks will be used to showcase the 
 *  wireless radio communication functionality. This same code should be 
 *  programmed to both LaunchPad development kits.
 *
 *  This BoosterPack relies on the SPI hardware peripheral and two additional 
 *  GPIO lines for SPI chip-select and GDO0 for packet handling. They use pins 18 
 *  and 19 respectively. 
 *
 *  In the default configuration, this BoosterPack is not compatible with an 
 *  external crystal oscillator. This can be changed, if necessary, and would
 *  require reconfiguration of the BoosterPack hardware and changes to the 
 *  AIR430BoostETSI library. Refer to the BoosterPack User's Manual if necessary.
 *
 *  ETSI regulations must be followed when using this library. This example 
 *  limits the wireless duty cycle to 0.1% per ETSI.
 *
 *  For complete information, please refer to the BoosterPack User's Manual 
 *  available at:
 *  www.anaren.com/.../cc110l-air-module-boosterpack-embedded-antenna-module-anaren
 *  
 *  To purchase the 430Boost-CC110L AIR module BoosterPack kit, please visit the 
 *  TI eStore at:
 *  estore.ti.com/430BOOST-CC110L-CC110L-RF-Module-BoosterPack-P2734.aspx
 */

/**
 *  The AIR430BoostETSI library uses the SPI library internally. Energia does not
 *  copy the library to the output folder unless it is referenced here. The order 
 *  of includes is also important due to this fact.
 */
#include <SPI.h>
#include <AIR430BoostETSI.h>

// -----------------------------------------------------------------------------
/**
 *  Defines, enumerations, and structure definitions
 */

#define ADDRESS_LOCAL    0x02
#define ADDRESS_REMOTE   0x01

/**
 *  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 txPacket;

// -----------------------------------------------------------------------------
// Main example

void setup()
{
  // 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);

  txPacket.from = ADDRESS_LOCAL;
  memset(txPacket.message, 0, sizeof(txPacket.message));

  // Setup serial for debug printing.
  Serial.begin(9600);

  /**
   *  Setup LED for example demonstration purposes.
   *
   *  Note: Set radio first to ensure that GDO2 line isn't being driven by the 
   *  MCU as it is an output from the radio.
   */
  pinMode(RED_LED, OUTPUT);       // Use red LED to display message reception
  digitalWrite(RED_LED, LOW);
}

void loop()
{
  int i, j;
  
  delay(1000);    // Send every second
  for (i = 0, j = '0'; i <= 0x2A; i++, j++)
  { 
    txPacket.message[i] = j;
  }
  Radio.transmit(ADDRESS_REMOTE, (unsigned char*)&txPacket, sizeof(txPacket));
  
  /**
   *  Warning: ETSI regulations require duty cycling of 0.1% per hour. Changing 
   *  this may invalidate ETSI compliance. Some margin has been added. Please 
   *  refer to Anaren's A110LR09 User's Manual for more information.
   */
  delay(500);
}
/**
 *  ----------------------------------------------------------------------------
 *  WirelessMonitorHub.ino - wireless monitor hub sketch using AIR430Boost ETSI driver.
 *  Copyright (C) 2012-2013 Anaren Microwave, Inc.
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License as published by the Free Software Foundation; either
 *  version 2.1 of the License, or (at your option) any later version.
 * 
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 * 
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 *
 *  This example demonstrates usage of the AIR430BoostETSI library which uses
 *  the 430Boost-CC110L AIR Module BoosterPack created by Anaren Microwave, Inc.
 *  and available through the TI eStore, for the European Union.
 *
 *  ----------------------------------------------------------------------------
 *
 *  Note: This file is part of AIR430Boost.
 *
 *  ----------------------------------------------------------------------------
 *
 *  Description
 *  ===========
 *
 *  Acts as a simple receiver for a star network. The hub node can receive both
 *  broadcast messages and messages directed to its assigned address. The hub
 *  node should not be assigned to address 0 (broadcast address). To create an
 *  additional network, simply change the hub address.
 *
 *  ----------------------------------------------------------------------------
 * 
 *  This example assumes that two BoosterPacks will be used to showcase the 
 *  wireless radio communication functionality. This same code should be 
 *  programmed to both LaunchPad development kits.
 *
 *  This BoosterPack relies on the SPI hardware peripheral and two additional 
 *  GPIO lines for SPI chip-select and GDO0 for packet handling. They use pins 18 
 *  and 19 respectively. 
 *
 *  In the default configuration, this BoosterPack is not compatible with an 
 *  external crystal oscillator. This can be changed, if necessary, and would
 *  require reconfiguration of the BoosterPack hardware and changes to the 
 *  AIR430BoostETSI library. Refer to the BoosterPack User's Manual if necessary.
 *
 *  ETSI regulations must be followed when using this library. This example 
 *  limits the wireless duty cycle to 0.1% per ETSI.
 *
 *  For complete information, please refer to the BoosterPack User's Manual 
 *  available at:
 *  www.anaren.com/.../cc110l-air-module-boosterpack-embedded-antenna-module-anaren
 *  
 *  To purchase the 430Boost-CC110L AIR module BoosterPack kit, please visit the 
 *  TI eStore at:
 *  estore.ti.com/430BOOST-CC110L-CC110L-RF-Module-BoosterPack-P2734.aspx
 */

/**
 *  The AIR430BoostETSI library uses the SPI library internally. Energia does not
 *  copy the library to the output folder unless it is referenced here. The order 
 *  of includes is also important due to this fact.
 */
#include <SPI.h>
#include <AIR430BoostETSI.h>

// -----------------------------------------------------------------------------
/**
 *  Defines, enumerations, and structure definitions
 */

#define ADDRESS_LOCAL    0x01

/**
 *  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;

// -----------------------------------------------------------------------------
// Main example

void setup()
{
  // 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);

  rxPacket.from = 0;
  memset(rxPacket.message, 0, sizeof(rxPacket.message));

  // Setup serial for debug printing.
  Serial.begin(9600);

  /**
   *  Setup LED for example demonstration purposes.
   *
   *  Note: Set radio first to ensure that GDO2 line isn't being driven by the 
   *  MCU as it is an output from the radio.
   */
  pinMode(RED_LED, OUTPUT);       // Use red LED to display message reception
  digitalWrite(RED_LED, LOW);
}

void loop()
{
  // Turn on the receiver and listen for incoming data. Timeout after 1 seconds.
  // The receiverOn() method returns the number of bytes copied to rxData.
  if (Radio.receiverOn((unsigned char*)&rxPacket, sizeof(rxPacket), 1000) > 0)
  {
    digitalWrite(RED_LED, HIGH);
    Serial.print("FROM: ");
    Serial.print(rxPacket.from);
    Serial.print(" MSG: ");
    Serial.println((char*)rxPacket.message);
		digitalWrite(RED_LED, LOW);
  }

  // Note: This sketch never transmits so no additional delay required to meet ETSI
  // requirements.
}

these are my transmitter and receiver code...........please let me knw where i have to change the code.

thank you

 

MSP432 I2C Slave Address handle no response

$
0
0

Hi,

i am using 3 I2C from the MSP432. Each I2C is attached to a connector, which a slave will be connected.

I dont know which Slave Address will be connected to it, because they are different from each other.

I know the Slave Address from each 3 devices, but i dont know in which port they will be connected.

So my goal is to go and try the Slave Addres in each I2C port, if there is no response the MCU will try the next one.

The problem is how to handle a no response?

At the moment the systems stops, but i can the MCU handle this situation and when a no response occurs, he timeouts somehow and the code runs normaly.

Any idea?

MSP432 Bootloader using UART

$
0
0

Hi,


is there an example code on how to flash the MSP432 using UART?

I have an embedded CPU which communicates with the MSP432 via UART.

On the User Guide i didnt find any example code

Based on the example i will have to make a driver on linux that flash the MSP if there is any update available.


Thanks,

Michael

Machine cycle calculation for MSP430F5529 Asm code

$
0
0

Hi friends

  I am facing problem with Machine cycles calculation for MSP430F5529 Controller with SMCLK=MCLK=Default DCO=1.048MHZ .Please refer the above snapshot

Regards

Beeresh

DLMS Library - Writing with set-request-normal doesn't trigger the template

$
0
0

Hello everyone,

I have a problem when my client application tries to writea profile_generic object through a set-request-normal method. I'm using a MSP430F67791.

The object definition is the following:

* inside the object_list[] in config.c 

{ASSOC_PC_MR_US_MS, CLASS_ID_PROFILE_GENERIC,          1, {  1,   0, 196,  10, 255, 255}, 8,  Obj_sampleObj, 0, NULL}

where Obj_sampleObj is defined as

static const struct attribute_desc_s Obj_sampleObj[] = {
    {1, ACCESS_PCR__MRR__USR_, TAG_OCTET_STRING,    (void *) object_list[11].instance_id, NULL},
    {2, ACCESS_PC___MRR__USRW, TAG_ARRAY,                     (void *) Data_Buffer, Capture_SampleObj_Data},
    {3, ACCESS_PC___MRR__USR_, TAG_ARRAY,                      (void *) sampleObj_Capture_Objects,NULL},
    {4, ACCESS_PC___MRR__USR_, TAG_UINT32,                     (void *) &(sampleObj.Capture_Period), NULL},
    {5, ACCESS_PC___MRR__USR_, TAG_ENUM,                       (void *) &(sampleObj.Sort_Method), NULL},
    {6, ACCESS_PC___MRR__USR_, TAG_STRUCTURE,          (void *) sampleObj_Sort_Object, NULL},
    {7, ACCESS_PC___MRR__USR_, TAG_UINT32,                     (void *) &(sampleObj.Entries_In_Use), NULL},
    {8, ACCESS_PC___MRR__USR_, TAG_UINT32,                     (void *) &(sampleObj.Entries), NULL},
};

and its parameters are defined as

void Capture_SampleObj_Data(void *data, int direction) {
	msg_info.template = sampleObj_Buffer_Template;
	msg_info.sz_template = sizeof(sampleObj_Buffer_Template);
	if (access_selector > 0) {
		if (SA_To_Entry == 0) {
			msg_info.num_entries = 1;
			msg_info.start_entry = 1;
		} else {
			msg_info.num_entries = SA_To_Entry - SA_From_Entry + 1;
			msg_info.start_entry = SA_From_Entry;
		}
	} else {
		msg_info.num_entries = 1;
		msg_info.start_entry = 1;
	}
	msg_info.column_szs = sampleObj_Column_Szs;
}

const uint8_t SampleObj_Sort_Object[] = {
    16 + 1,
        4,
            TAG_UINT16, INJECT16(CLASS_ID_CLOCK),
            TAG_OCTET_STRING, 6, 0, 0, 1, 0, 0, 255, // Date & Time
            TAG_INT8, 3,
            TAG_UINT16, INJECT16(0)
};


const uint8_t SampleObj_Capture_Objects[] = {
    (6*18 + 1),
        /*TAG_ARRAY,*/ 6,
            TAG_STRUCTURE, 4,
                TAG_UINT16, INJECT16(CLASS_ID_DATA),
                TAG_OCTET_STRING, 6, 0, 0, 96, 10, 1, 0, 
                TAG_INT8, 3,
                TAG_UINT16, INJECT16(0),
            TAG_STRUCTURE, 4,
                TAG_UINT16, INJECT16(CLASS_ID_DATA),
                TAG_OCTET_STRING, 6, 0, 0, 96, 10, 2, 0, 
                TAG_INT8, 3,
                TAG_UINT16, INJECT16(0),
            TAG_STRUCTURE, 4,
                TAG_UINT16, INJECT16(CLASS_ID_DATA),
                TAG_OCTET_STRING, 6, 0, 0, 96, 10, 3, 0, 
                TAG_INT8, 3,
                TAG_UINT16, INJECT16(0),
            TAG_STRUCTURE, 4,
                TAG_UINT16, INJECT16(CLASS_ID_DATA),
                TAG_OCTET_STRING, 6, 0, 0, 96, 10, 4, 0, 
                TAG_INT8, 3,
                TAG_UINT16, INJECT16(0),
            TAG_STRUCTURE, 4,
                TAG_UINT16, INJECT16(CLASS_ID_DATA),
                TAG_OCTET_STRING, 6, 0, 0, 96, 10, 4, 0,
                TAG_INT8, 3,
                TAG_UINT16, INJECT16(0),
            TAG_STRUCTURE, 4,
                TAG_UINT16, INJECT16(CLASS_ID_DATA),
                TAG_OCTET_STRING, 6, 0, 0, 96, 10, 5, 0, 
                TAG_INT8, 3,
                TAG_UINT16, INJECT16(0),
};

the template is the following:

const uint16_t sampleObj_Column_Szs[]={ 4, 9, 14, 16, 18, 20};
const uint8_t sampleObj_Buffer_Template[] = {
    STUFF_DATA | TAG_STRUCTURE, 6,
      STUFF_DATA | TAG_ENUM,                     ITEM_TAG_Val_1,
      STUFF_DATA | TAG_FLOAT32,                INJECT32(ITEM_TAG_Val_2),
      STUFF_DATA | TAG_UINT32,                   INJECT32(ITEM_TAG_Val_3),
      STUFF_DATA | TAG_ENUM,                     ITEM_TAG_Val_4,
      STUFF_DATA | TAG_ENUM,                     ITEM_TAG_Val_5,
      STUFF_DATA | TAG_ENUM,                     ITEM_TAG_Val_6,
};


the structure holding the device data is defined as:

typedef struct sSampleObj SampleObj;
struct sSampleObj{
  uint8_t       val_1;
  float         val_2;
  uint32_t      val_3;
  uint8_t       val_4;
  uint8_t       val_5;
  uint8_t       val_6;
  
  uint32_t Entries_In_Use;
  uint32_t Entries;
  uint32_t Capture_Period;
  uint8_t  Sort_Method;
};


I added the declaration of ITEM_TAG_Val_1...6 inside the enum object in config.h and modified the get_numeric_item and set_numeric_item in app_server_msg.c in this way:

int64_t get_numeric_item(int item)
{
  int64_t val;
  
  switch (item)
  { 
  case ITEM_TAG_Val_1:          val = sampleObj.val_1;    break;
  case ITEM_TAG_Val_2:          memcpy(&val,&(sampleObj.val_2),4);    break;
  case ITEM_TAG_Val_3:          val = sampleObj.val_3;    break;
  case ITEM_TAG_Val_4:          val = sampleObj.val_4;    break;
  case ITEM_TAG_Val_5:          val = sampleObj.val_5;    break;
  case ITEM_TAG_Val_6:          val = sampleObj.val_6;    break;
  }
  return val;
}


void set_numeric_item(uint8_t item, uint8_t *data, uint16_t len){
  uint32_t value;
  
  switch(item){
    
  case ITEM_TAG_Val_1:  memcpy(&(sampleObj.val_1), data, 1);                                                    break;
  case ITEM_TAG_Val_2:  memcpy(&(sampleObj.val_2), data, 1);    sampleObj.val_2=swap32(sampleObj.val_2);        break;
  case ITEM_TAG_Val_3:  memcpy(&(sampleObj.val_3), data, 1);    sampleObj.val_3=swap32(sampleObj.val_3);        break;
  case ITEM_TAG_Val_4:  memcpy(&(sampleObj.val_4), data, 1);                                                    break;
  case ITEM_TAG_Val_5:  memcpy(&(sampleObj.val_5), data, 1);                                                    break;
  case ITEM_TAG_Val_6:  memcpy(&(sampleObj.val_6), data, 1);                                                    break;
    
  default:
    break;
  }

}


Meanwhile get_numeric_item is called whenever i try to read the item, when I try to write it the set_numeric_item is not (even if the server replies with success).
I should have set correctly the access rights since I'm connecting to the server as US. This is the log of an attempt of writing followed by a read:

client to server (write): 7E A0 2F 03 61 76 41 9D E6 E6 00 C1 01 81 00 07 01 00 C4 0A FF FF 02 00 01 01 02 06 16 03 17 40 D0 00 00 06 00 00 05 DC 16 03 16 01 16 00 91 35 7E
server to client (write reply): 7E A0 10 61 03 96 54 62 E6 E7 00 C5 01 81 00 36 CF 7E 

client to server (read): 7E A0 19 03 61 98 59 94 E6 E6 00 C0 01 81 00 07 01 00 C4 0A FF FF 02 00 7C 5A 7E  
server to client (read reply): 7E A0 2C 61 03 B8 EE 71 E6 E7 00 C4 02 81 01 00 00 00 01 00 16 01 01 02 06 16 01 17 40 A3 33 33 06 00 00 05 DC 16 01 16 01 16 01 E7 DF 7E 

Thanks for your help




After update MAP_SPI_getInterruptStatus doesn't work, but SPI_getInterruptStatus works

$
0
0

Yesterday I updated MSPWare432 to the newest verstion. After the update I found an function that didn't work, to work, and I found a function that did work, but now doesn't any more. I am very concerned about this because I am we are making a new product with MSP432 and using MSPWare and I am afraid to write big chunks of code for it and when an update comes, some things don't work any more.

I'll give a part of the code I used but that should be enough. I am communicating with the CC1200. Before update everything worked with the MAP_SPI_getInterruptStatus(RF_SPI, RF_SPI_TRANSMIT_INTERRUPT); but now it doesn't wait for the transmit interrupt to be ready and overwrites. I was looking on the SPI lines on my oscilloscope and when i remove MAP_ prefix it works. I also saw that now in the examples you don't use MAP functions any more.

One last thing. Where can I find the update notes for the MSPWare432?

// Defines
#define RF_SPI EUSCI_B0_BASE
#define RF_SPI_TRANSMIT_INTERRUPT EUSCI_B_SPI_TRANSMIT_INTERRUPT
#define RF_SPI_RECEIVE_INTERRUPT EUSCI_B_SPI_RECEIVE_INTERRUPT


void ConfigureRFBurstAccess(const registerSetting_s* config) { uint32_t i; SelectRFModule(); // Command byte that says burst write from address 0x00 TransmitByteToRF(0x40); for(i = 0; i<0x2F; i++) { TransmitByteToRF(config[i].value); } // The CSn for RF needs to be pulled up to cancel the // burst into the register space and then it needs to // be pulled down again to start burst into extended // register space DeselectRFModule(); SelectRFModule(); // Command byte that says burst write in extended register space TransmitByteToRF(0x6F); // Command byte that says from which address to burst write TransmitByteToRF(0x00); for(i = 0; i<0x3A; i++) { TransmitByteToRF(config[i+0x2F].value); } DeselectRFModule(); } void TransmitByteToRF(uint8_t byte) { // Wait for transmit buffer to be empty and transmit byte while (!(SPI_getInterruptStatus(RF_SPI, RF_SPI_TRANSMIT_INTERRUPT))); MAP_SPI_transmitData(RF_SPI, byte); } uint8_t ReceiveByteFromRF() { while (!(SPI_getInterruptStatus(RF_SPI, RF_SPI_RECEIVE_INTERRUPT))); return MAP_SPI_receiveData(RF_SPI); }

MSP430F5510 Custom Board with USB not detected

$
0
0

Hello TI Community,

We have a custom MSP430F5510 board with USB .

We have connected a 4Mhz Crystal to XT2 pin and all the necessary connections have been take care off.

When we connect the board to a windows PC, Should it be recognized as a COM port or HUD device ?

Nothing happens and when we pull the USB PUR pin high on the board

Windows detects it but fails to recognize the device and gives the error as

Unknown USB Device ( request for the USB device descriptor failed ) ( attached screenshot )

Our aim is to burn the firmware onto the F5510's flash - I have also attached our USB schematic

Kindly help us to solve this issue

LCD interfacing with MSP430F5529

$
0
0

Dear Sir,
           I am interfacing LCD with MSP430F5529.I am using LCD data lines as D4=P5.0,D5=P5.1,D6=P5.6,D4=P5.7 and R/W=p4.7,RS=P4.6,EN=P8.0.Can anyone suggest me the logic to write data to lcd.Is there clock initialization required?How  can i  get 1ms delay in msp430f5529 operating at SMCLK+MCLK+Default DCO=1.048576MHZ.

Regards
Beeresh

After building , running the code on MSP432P401R gives error.

$
0
0

Hi everyone,

I was working with msp432 and it was working fine ( few example codes). Suddenly, Msp432 is building without any errors but while debugging it gives error.

the error is given below

Error connecting to the target:
(Error -1063 @ 0x0)
Device ID is not recognized or is not supported by driver. Confirm device and debug probe configuration is correct, or update device driver.
(Emulation package 6.0.222.0)

I also tried in other ide like energia, still the same error comes.

It was working fine before .

Kindly help me in this regard.

Thanks ,

Andrew Gigie

MSP430 Flash Memory Segment Offset

$
0
0

Hello

I am configuring an MSP430F47186 to have a separate boot loader area in main memory.

My question relates to the 512byte segments in the Flash memory.

The Flash memory starts at address 0x3100, this is not an integer multiple of 512.

Does this mean that for this part of the flash, the Segment boundaries are offset by 256?

When I had my code on addresses at multiples of 512 and then wrote two applications, one partially overwrote the other with 0xFFFF.

I then changed it so that the boundary was offset by 256 and they no longer clash.

Is my understanding correct, the boundaries are effectively at 0x3100, 0x3300, 0x3500, etc?


Thanks

Morgan

Viewing all 21927 articles
Browse latest View live