Does CCS v6.1.3 with GNU GCC V5.3.0.219 compiler for MSP430 support C++11 or C++14?
Does GCC compiler for MSP430 support C++11?
MSP430 and I2C frequency
Hello,
I have an MSP430F6779A with an I2C bus activated (to drive a little oled screen).
My clocks are : MCLK = 8 MHz, SMCLK = 4 MHz and ACLK (from XT1) = 32,768 kHz.
// Set the correct VCore. core_setVcoreUp(PMMCOREV_0); core_setVcoreUp(PMMCOREV_1); core_setVcoreUp(PMMCOREV_2); // Configure XT1. UCSCTL6 &= ~(XT1OFF); UCSCTL6 |= XCAP_3; do { UCSCTL7 &= ~(XT1LFOFFG); } while (UCSCTL7 & XT1LFOFFG); // Configure DCO. UCSCTL3 |= SELREF__XT1CLK; __bis_SR_register(SCG0); UCSCTL0 = 0x0000; UCSCTL1 = DCORSEL_5; UCSCTL2 = FLLD_1 | 245; __bic_SR_register(SCG0); // Init clocks : MCLK = SMCLK = 8 MHz, ACLK = 32768 Hz. UCSCTL4 = SELA__XT1CLK | SELS__DCOCLKDIV | SELM__DCOCLKDIV;
// Divide SMCLK by 2 > 4 MHz. UCSCTL5 |= DIVS__2; __delay_cycles(250000); do { UCSCTL7 &= ~(XT1LFOFFG | DCOFFG); SFRIFG1 &= ~OFIFG; } UCSCTL6 &= ~(XT1DRIVE_3);
Here what i can see on my oscilloscope. It seems OK...
Now, i configure my I2C bus :
P2SEL0 |= BIT5 | BIT6; // Set P2.5,P2.6 to UCB0SCL, UCB0SDA UCB0CTLW0 |= UCSWRST; // Enable SW reset UCB0CTLW0 |= UCMST | UCMODE_3 | UCSYNC | UCSSEL__SMCLK; // I2C Master, SMCLK UCB0BRW_L = 10; // Divide SMCL by 10 >> 400 kHz UCB0BRW_H = 0; UCB0I2CSA = 0x3C; UCB0CTLW0 &= ~(UCSWRST); UCB0IE |= UCTXIE;
But with this code, my oled screen doesn't work because data are not correct.
If i check with my oscilloscope, i obtain 333 kHz clock with frequency divider 10, and 4 MHz / 10 is not equal to 333 kHz ???
And if i test with divider 2 (UCB0BRW_L = 2), it works !!! But i obtain a frequency of 555 kHz (while my oled screen has a frequency max of 400 kHz), and the frequency is not equal to 4 MHz / 2 ???
I must be missing something here...
Do you have an idea ?
Thank you :-)
Christophe
I2C problem with second data burst.
Below my code:
int Read_TMP102(unsigned char TMPaddr)
{
// Protocol Base >>[START BIT][ADDR+R/W][REGISTER][DATA1][DATA2][STOP BIT]
//I2C description document TI SLAU144J - page 461 (www.ti.com/.../slau144j.pdf)
while((UCB0STAT & BUSY)!= 0); // free bus
while (UCB0CTL1 & UCTXSTP); // Ensure stop condition to sent
// this part of code send the command to set the register that will be read.
// command format = [start_bit][address + r/w][command to read][stop bit]
i2c_tx(TMPaddr); // this function transmit the I2C address 0x48 ( TMP102) + register.
i2c_stop(); // generate de stop bit.
while((UCB0STAT & BUSY)!= 0); // verify if bus is free
//start the read command
UCB0CTL1 &= ~UCTR; // change I2C controller to receive mode, in this point address is loaded ( UCBxI2CCSA = slave address)
UCB0CTL1 |= UCTXSTT;
while((IFG2 & UCB0RXIFG )==0); // send start condiction to transceiver
RX_INH = UCB0RXBUF;
while((IFG2 & UCB0RXIFG )==0); // wait to receive a new byte.
RX_INL = UCB0RXBUF;
//GENERATE STOP BIT
//while((UCB0STAT & BUSY)!= 0); // generate the stop condiction
UCB0CTL1 |= UCTXSTP;
while(UCB0CTL1 & UCTXSTP);
Data_out = (int)RX_INH<<8;
Data_out +=(int)RX_INL;
__delay_cycles(10);
return Data_out;
}
The strange behavior is that in first time that I sent the read command the MSP send one extra clock train and with it I receive that ACK of last TMP byte, after The MSP send only the correct number or train clock.
the TMP102 is configured with 0x60A0 ( default). All ack perfect.
After it i send command to set and read the sensor
Sensor response the commands but now in I2C appear a new clock byte. FF ( that is wrong), but the data measured but sensor is right . After it I send a new command to read the temperature again but now dont have the last byte.
I receive the last byte but now the NAK happen, and again the information is right. I verified the registes before and after the both trasmission and is everything same .
Someone can help me solve this problem. Thanks
MSP432 LaunchPad V2 with EDUMKII running Keil uvision V5.20 and MSPWare 3.40.00.25 no LCD output
I've tried all the examples (except for Microphone FFT who’s code size was to big for Keil) and never see any output on the LCD.
I've copied the LCD data to the Serial channel and see the applications seem to be working, just no LCD output.
QUESTON 0: Have you used my hardware/software setup and did the LCD work?
A Keil application for MSP432 LaunchPad seems to use a code skeleton of :
startup_msp432p401r_uvision.s //initialize the interrupt vectors & stack, call SystemInit, call _main
system_msp432p401r.c //contains SystemInit, sets vcoreX, waits, and mclk
_main.c //any additional initialization and loop on application code
Within SystemInit prior to updating the CS registers, CS->KEY is set to unlock the CS module.
The __main for these LCD example applications update the clock before the application loop.
QUESTION 1: Below in main I don’t see CS->KEY set, is this handled by the “MAP_CS_setDCOCenteredFrequency” and “MAP_CS_init_ClockSignal”?
void main(void) { /* Halting WDT and disabling master interrupts */ MAP_WDT_A_holdTimer(); MAP_Interrupt_disableMaster(); /* Set the core voltage level to VCORE1 */ MAP_PCM_setCoreVoltageLevel(PCM_VCORE1); /* Set 2 flash wait states for Flash bank 0 and 1*/ MAP_FlashCtl_setWaitState(FLASH_BANK0, 2); MAP_FlashCtl_setWaitState(FLASH_BANK1, 2); /* Initializes Clock System */ MAP_CS_setDCOCenteredFrequency(CS_DCO_FREQUENCY_48); MAP_CS_initClockSignal(CS_MCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_1 ); MAP_CS_initClockSignal(CS_HSMCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_1 ); MAP_CS_initClockSignal(CS_SMCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_1 ); MAP_CS_initClockSignal(CS_ACLK, CS_REFOCLK_SELECT, CS_CLOCK_DIVIDER_1); /* Initializes display */ Crystalfontz128x128_Init(); … more of _main
Within Crystalfontz128x128_Init() the spi is configured
eUSCI_SPI_MasterConfig config =
{
EUSCI_B_SPI_CLOCKSOURCE_SMCLK,
LCD_SYSTEM_CLOCK_SPEED,
LCD_SPI_CLOCK_SPEED,
EUSCI_B_SPI_MSB_FIRST,
EUSCI_B_SPI_PHASE_DATA_CAPTURED_ONFIRST_CHANGED_ON_NEXT,
EUSCI_B_SPI_CLOCKPOLARITY_INACTIVITY_LOW,
EUSCI_B_SPI_3PIN
};
LCD_SYSTEM_CLOCK_SPEED is defined as 48,000,000.
LCD_SPI_CLOCK_SPEED is defined as 16,000,000 (1/3 of the system clock).
The main above sets the DCO to 48MHz and 1 divisor for MCLK, HSMCLK, and SMCLK.
QUESTION 2: Should this configuration work (with the __main clock init shown)?
Shouldn’t the MCLK be running off HFXT 48MHz crystal, with SMCLK off DCO running at 16MHz?
QUESTION 3: If this is true which of the two DCO ranges are recommended and what
should be the value of Ndcotune (Kdcoconst and FCALcsdcoxrcal values)?
Thank you for feedback,
Morris
Weird I2C bus activity
I tried to use the I2C of MSP430F6736 as the master I2C device. I found very weird stuff during the code debugging. I could see the SCL line has the 9 clock pulse. I also could see the start bit in the SDA line. But I just couldn't get the data output from the SDA line (so there would be no ACK from slave). The SDA is hold low during the whole byte transmit stage (See figure below). Even I removed the slave device from the picture. It still has the same result. What could cause this weird issue? I have checked the UCB0TXBUF register got what it shall get (such as 0x55).
MSP432 RTC Interrupt
Hi,
i'm using rtc interrupt to have an event every 1 minute (default setting of rtc is minute changed event). It works and i have no problem. Is it possible using rtc interrupt for second changed event? For example every 30 seconds i want p1.0 led on.
Thanks,
Luca
EXTERNAL INTERRUPT priority VS TIMER INTERRUPT priority
hi,
i am using msp430f6779 controller. in which i am displaying a block of seven segment using timer interrupt per 4 milli second.
i am also using an external adc to read data. when adc completes the conversion it give a high to low signal i am taking that signal as an external interrupt.
i just want to know is there any chance i can miss adc data due to interrupt clashing.????
Equivalent components from Texas Instruments?
Im working on a project for the disabled persons which recogonises the breathe patterns and simulates them as words with certain algorithms,
Now TEXAS INSTRUMENTS have come up to fund me by providing the parts required by me and they gurantee to buy me a patent on my name. All they require is to use almost all components of their own,I've managed to find the equivalent components, but couldn't figure out all please help me out . Any kind of suggeston is appreciated.
The parts I use:
1. Arduino Uno
2. Mems Microphone ADMP401 [MEMS Microphone][2]
3. Emic 2 Text to Speech Convertor [https://www.sparkfun.com/products/11711]
Similar components from Texas I found on Texas Instruments:
1. MSP430 LaunchPad [http://www.ti.com/tool/msp-exp430g2#0]
other two components are providing a varied views and opinions
I'm just a begineer and need a hand to work on these.
If I'm worng on choosing any of the components please suggest me.
Schematic link:
drive.google.com/.../view
[2]: www.sparkfun.com/.../9868
ez430-f2013 - writing flash from a visual studios app.
is there a driver etc. that will allow me to write to flash via the ez430-f2013 USB interface? I would like to give users the ability to customize the their display without exiting the user application.
Thanks
DeeDee
SLAA503 for MSP430F5529 onto MSP43G2553
Hello All,
Firstly, I apologise if this is in the wrong forum. A little unsure if this is an issue specific to CCS or the boards.
CCS and the TI ecosystem is something that is new to me, so I am just trying to figure things out.
I am working with a DRV8313EVM, I have got the board connected via my MSP-EXP430 launch pad and that works fine with the DRV8313 Release code. The following is based on what I've obtained from this PDF: www.ti.com/.../slaa503.pdf
I am looking at implementing the Closed Loop Control for my motor initially just to verify the HALL sensors. I full expected for this NOT to work and it didn't
When I import into CCS and go into properties I see this:
I update the settings to reflect my environment:
When I compile I get all sorts of errors:
Now this I expected, but what I am struggling to define is if any of the following is true:
1) Are these errors because these referenced definitions in CORE LIB have been removed/changed from TI 3.3.2 to TI 15.12.3.LT
2) Are these definitions specific to the MSP430F5529 this solution was developed for?
I'm struggling to determine where these definitions are made firstly (Is there some kind of TI equivalent of MSDN I have missed?) and how they either need to be translated to MSP43G2553 or updated to new definitions or if the entire document is now obsolete and I have to skip this step and start doing my own programming.
Any help that may put into the right track is greatly appreciated.
Thanks!
Adam
MSP430 HID Datapipe detection delay in Android
I have an MSP430-based device operating with a HID Datapipe over USB. I'm connecting this device to an Android tablet running an app I wrote based on information from slaa630.pdf: Android Applications With MSP430™ USB on Mobile Devices. It works great after the device is recognized, but for some reason it takes a long time to be recognized (on the order of 10 seconds). The same hardware on windows takes less than 1 second to be recognized. Does anyone have any idea what I can do to make this faster, or how I can figure out what is causing the delay?
Thanks.
i2c with msp430g2553 to lcd
Hi Everybody,
I have msp430g2553 with launchpad and i'm working with ccs enviroment
I need to communicate with lcd with i2c bus protocol.
I wanted to know:
1. is there an examples for msp430g2553 with i2c protocol?
2. what lcd do you recommand to work with i2c protocol?
Thank you for your help.
MSP430FR5739 I2C repeated start issue
Hey everyone,
for some reason when i send a repeated start i cant put it in reciever mode therefore setting the R/W bit high. After watching debug mode and trying to run to line (UCB0CTLW0 &= ~UCTR) it skips over it and keeps it high there causing the R/W bit to stay low. why won't it execute this command. See below for a picture of my waveforms i can make. Also see below for the waveform (figure 8) im trying to make. please help.
I2c sequence:
transmit start in write mode
send command
send repeated start in read mode
#include <msp430.h>
#define SLAVE_ADDRESS 0x5A
int Temperature;
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
P4DIR |= BIT0;
P4OUT |= BIT0;
P1SEL1 |= BIT6 + BIT7;
UCB0CTL1 |= UCSWRST;
UCB0CTLW0 |= UCSYNC + UCMODE_3 + UCSSEL_2+ UCMST;
UCB0TBCNT |= 0x0002;
UCB0BR0 = 0x001F;
UCB0BR1 = 0;
UCB0CTLW1 = 0;
UCB0CTLW0 &= ~UCTR;
//UCB0CTLW0 |= UCSLA10;
UCB0I2CSA = SLAVE_ADDRESS;
// UCB0CTLW0 = UCSSEL_2 //+ UCSWRST;
UCB0CTL1 &= ~UCSWRST;
// UCB0IE |= UCTXIE + UCRXIE + UCNACKIFG;
P1OUT &= ~BIT7;
// __delay_cycles(100000);
for (;;) {
P1OUT &= ~BIT7;
__delay_cycles(100000);
P1OUT |= BIT7;
P1SEL1 |= BIT7;
UCB0CTLW0 |= UCTR;
UCB0CTLW0 |= UCTXSTT;
while ((UCB0CTLW0 & UCTXSTT) != 0)
//{}
UCB0TXBUF = 0x0007;
while ((UCB0IFG & UCTXIFG) != 0)
UCB0CTLW0 &= ~UCTR;
UCB0CTLW0 |= UCTXSTT;
}
}
text file to msp flash
Hi,
I have a text file with some data. How do I copy it into flash memory of MSP430?
I am using g2553.
Thnx
msp4305529 launch pad microphone ADC input error
I'm trying to make msp430f5529 launchpad read audio signal from microphones. I'm testing these two mics:
1) https://www.sparkfun.com/products/9868
2) https://www.adafruit.com/products/2716
When I test the mic signal on scope, it is alright. However when I connect the signal to ADC12, it only tells me the input is a DC-like signal, almost constant value no matter how the audio signal changes. Is there bench code to test ADC12? Or something is wrong with the impedance?
Any help will be appreciated! Thanks guys.
Liang
Zigbee+Blutooth using CC2531
Hii,
I am using CC2531 module for home automation application using zigbee connectivity. Now i want to have Bluetooth connectivityy for my application with the same board. So is there any way to get bluetooth connectivitty using cc2531 module, like by using bluetooth stack or something?? is there any other device which we can use for zigbee + bluetooth application together??
Thanks
MSP430FG6625 Master clock (MCLK) doesn't work with 24Mhz (XT2) clock.
Hi,
I have a question regarding the 24Mhz clock which I am getting it from external XT2 cristal. I configure my code to use 24Mhz XT2 as the main clock for SMCLK and MCLK. I also verified on the scope that the SMCLK is getting 24 Mhz clock, but when I run my code it freezes when I use __delay_cycle() to generate some microsecond delay.
I did some testing and I discover that my code executes with the same delay function when I configure the MCLK with (divide by 2)12 MHz frequency (f / 2).
My question is why my code never pass through the delay function?
It seems that the MCLK doesn't like the 24 MHz frequency. Is it true? Can I not run my MCLK at 24Mhz? If so then why not. I mean the spec says the MSP430FG6625 can support up to 32 MHz clock.
FYI, following is the part of my code:
#define CYCLES_PER_US 24L
#define DELAY_US(x) __delay_cycles((x * CYCLES_PER_US))
WDTCTL = WDTPW + WDTHOLD; //Stop watchdog timer
clock() //Configure clock SMCLK=MCLK=XT2 (24Mhz)
DELAY_US(550); // <-----It stuck at this line of code when using 24Mhz for MCLK, but it pass thorugh when using 12Mhz for MCLK
printf("Executing the code\n");
foo_func() //some function to call and execute rest of the code.
MY clock configure code:
void clock(){
CTSD16CCTL0 |= CTSD16SC;
do{
CTSD16CTL &= ~CTSD16OFFG;
}while (CTSD16CTL&CTSD16OFFG);
while(BAKCTL & LOCKBAK)
BAKCTL &= ~(LOCKBAK);
P7SEL |= BIT2; // Port select XT2
UCSCTL6 &= ~XT2OFF; // Enable XT2
UCSCTL3 |= SELREF_2; // FLLref = REFO
// Since LFXT1 is not used,
// sourcing FLL with LFXT1 can cause
// XT1OFFG flag to set
UCSCTL4 |= SELA_2; // ACLK=REFO,SMCLK=DCO,MCLK=DCO
// Loop until XT1,XT2 & DCO stabilizes - in this case loop until XT2 settles
do
{
UCSCTL7 &= ~(XT2OFFG | XT1LFOFFG | /*XT1HFOFFG |*/ DCOFFG);
// Clear XT2,XT1,DCO fault flags
SFRIFG1 &= ~OFIFG; // Clear fault flags
}while (SFRIFG1&OFIFG); // Test oscillator fault flag
UCSCTL6 &= ~XT2DRIVE0; // Decrease XT2 Drive according to expected frequency
UCSCTL4 |= SELS_5 | SELM_5; // SMCLK=MCLK=XT2
}
Thanks.
MSP430FR5738 loses memory
Hi,
I have a small board with the MSP430FR5738 MCU. Sometimes it suddenly loses the program memory and if I try to read the contents it is often all 0xFF or 0x00.
Then I have to program it from scratch. Does anyone else have the same problems and do anyone know a solution?
BR,
Morten Mosgaard
MSP430FR4133 Support required
Hello Sir,
We have been using MSP430FR4133 controller for our product and for which we have developed a prototype device and to check the function of the project. In which we are using CAPACITIVE touch which is in built function in MSP430FR series. We are using single touch as a button in project, where we have designed four such button and creating an event. But we are finding some problems during a high spike in 230V AC or noise created AC load creates noise or high harmonics. During these time the CAPACITANCE value is been changed due to which the device starts malfunctioning. I have given a brief description of the prototype design of CAP touch below for the better understanding and reference. So, please do refer and reply at the best to help our product to be a successful one. We are now on the end of the product development, also we are going do 2nd revision for which we need guide lines to improve our product.
Design description:
1. using CAP touch as single touch button.
2. designed as CAP Addon card which is interface with controller through header pin connector of 2.54mm pitch.
3. the MCU MSP430FR is placed near to connector as to avoid the loop structure or antenna creation.
4. Layout of CAP button:: PAD size - 10mm
:: keepout dist. from PAD to GND - 1mm (recommended)
:: GND plan top layer 75% hatched type and bottom layer 25% hatched type
:: the shape of GND plan to PAD is hexagonal type
:: PAD shape is round
:: PAD is unmasked green open to air
:: NP ohm pull down resistor is connected on signal line from PAD to controller, it is near to MCU
:: we have keept 2mm of through hole in center of PAD for LED indication.
:: signal trace is 12mils(0.3mm).
So, describing these design layout please help us to solve our problem and issues regards the same. Also I have described the doubts and query as we are doing REVISION-2 layout for CAP touch card PCB. So, please do refer and reply as soon as possible as it is very much urgent.
Query and Doubts:
1. what should be the distance between PAD and MCU OR placement of PAD from MCU. It is compulsory for us to design CAP touch as separate PCB only as addon card to controller PCB.
2. should we connect resistor in series from PAD and MCU for ESD protection, as to avoid RF noise nearer. IF yes what should be appropriate value of the resistor. Also where should the resistor be placed, whether near to MCU or PAD.
3. Layout guidance, what should be GND pouring hatched type or 100% filled GND.
4. what should be the size of average PAD for a human touch(recommended 10MM)
5. whether the PAD should be mask with green layer or not
6. what should be the PAD shape for smooth sense.
Kindly help to support so that we can take our product in production.
Thanks in advance
Pradhan
Delay calculation in MSP430F5529
Hi friends,
I want to calculate 1ms delay in MSP430F5529 controller with XT2 crystal as 8MHZ and XT1 crystal as 32KHZ
regards
beeresh