Dear All
i am trying to learn msp430g2553 i have a basic question ,
how to route the internal clock generated to an output pin for testing the frequency
Dear All
i am trying to learn msp430g2553 i have a basic question ,
how to route the internal clock generated to an output pin for testing the frequency
Hi
I am having trouble programming the MSP430G2553 ucontroller on the DAC161S997EVM board. I started to write some code to toggle the LEDs and setup ADC on the uC. I programmed the EVM via the JTAG using a MSP-FET430UIF tool. My project was running along smoothly as gradually started to build up the code, adding feature by feature. I reached a point yesterday where I was ready to start testing the DAC on the EVM. This is programmed via the uC over the SPI comms. I added the code below to setup the SPI comms on the MSP430G2553 on the DACEVM.
void SPI_Initialise(void)
{
P2OUT |= BIT0;
P1SEL = BIT5 | BIT6 | BIT7;
P1SEL2 = BIT5 | BIT6 | BIT7;
UCB0CTL1 = UCSWRST;
UCB0CTL0 |= UCCKPH + UCMSB + UCMST + UCSYNC; // 3-pin, 8-bit SPI master
UCB0CTL1 |= UCSSEL_2; // SMCLK
UCB0BR0 |= 0x02; // /2
UCB0BR1 = 0; //
UCB0CTL1 = ~UCSWRST; // **Initialize USCI state machine**
}
After adding this I downloaded and debugged the code to the uC on the EVM. I am now unable to write any new code to the uC. Everytime I attempt to download the code (IAR) I get the fllowing error
Wed Jun 15, 2016 09:32:08: Security Fuse has been blown : (OpenDevice) , Device=MSP430G2xx3, PwLength=0x0
Wed Jun 15, 2016 09:32:09: Fatal error: Could not find device (or device not supported) Session aborted!
Now I am fairly new to MSP430's and this is the first time I have used this DAC161S997EVM, but would I be correct in assuming this issue is to do with the fact that the SPI comms lines are shared with the JTAG pins? This makes sense as the code loaded first time (after the addition of the SPI setup) but hasn't been able to communicate since.
Are there any other reasons why the security fuse would blow? I was reading that it is usually to do with a timeout issue, which again points to the shared JTAG/SPI lines.
I am new to this so please be kind, but I can't understand why the JTAG lines would be shared with SPI lines needed to communicate with the on board DAC? If that is the reason ofc for my issues
Any help would be appreciated
Dave
Hello;
Sir;
This is Pratik Debnath working on Msp432p401r ...Recently I have finished with Kentec3.5'' display(BOOSTXL-K350QVG-S1) using Grlib example given in Mspware...
Now I am trying to interface msp432 with Kentec4.3'' display(k430wqc_v3_ff) in 8bit mode....I have downloded its library from ek-tm4c123gxl-boost-l35...I have edited the files I have downloaded Kentec480x272x16_SSD1963_8bit.c and Kentec480x272x16_SSD1963_8bit.h...
But I am not able to get any display output...Though I dont have any backlight driver I used BOOSTXL-K350QVG-S1 backlight driver to test that 4.3'' display is working or not and it's backlight is working..
Sir please varify my code with wiring diagram I have attached and correct me where I am worng..
Please help me...Please ..
Regards
Pratik Debnath
8655919874(Please visit the site to view this file)
what is the difference between Micro controller and Microprocessor?
dear all
what is the maximum supply voltage of msp 430
hi i am new in using msp430 launchpad anybody give the ccs code
Hello,
I would like to know how to implement and use a Software timer on msp430.
I've been using msp430f5529.
Thank You
I can not get the source code of the MAVRK from the server for it is not active.so anyone can share it with me.
Hello
I am talking to an IMU (BNO05) via MSP430 launchpad. they are connected via the UART. Below is the code that I use to read the acceleration data. However, when I press the pause
buttom then I get ABNORMAL PROGRAM TERMINATION, given that I am getting the data. Why is that? is it because I am using the __bic_SR_register_on_exit(LPM0_bits); in the
RX ISR and __bic_SR_register_on_exit(LPM3_bits+GIE); in the main?
Another question:
If I used while(1) in the main as below, i.e., no __bis_SR_register(LPM0_bits); in the RX ISR, then how will the program leave the ISR (based on what condition)?
Thank you
#include "msp430g2553.h" char xLSB; char xMSB; char yLSB; char yMSB; char zLSB; char zMSB; typedef struct uart // UART { char *bufTXpnt; // UART TX buffer pointer unsigned int TXbuflen; // the lenght of TX block char *bufRXpnt; // UART RX buffer pointer unsigned int RXbuflen; // the lenght of RX block char TXbuffer[20]; char RXbuffer[20]; } uartstruct; void setMSP430Pins() { //--------- Setting the UART function for P1.1 & P1.2 --------// P1SEL |= BIT1 + BIT2; // P1.1 UCA0RXD input P1SEL2 |= BIT1 + BIT2; // P1.2 UCA0TXD output return; } void set_UCS() { //------------------- Configure the Clocks -------------------// // DCOCTL = 0; // Select lowest DCOx and MODx settings BCSCTL1 = CALBC1_12MHZ; // Set range DCOCTL = CALDCO_12MHZ; // Set DCO step + modulation } void uart_init(void){ IE2 &= ~(UCA0TXIE | UCA0RXIE | UCB0TXIE | UCB0RXIE); // Disable all USCIx0 TX & RX interrupts UCA0CTL1|=UCSWRST; UCA0CTL1|= UCSSEL_2; //------------ Configuring the UART(USCI_A0) ----------------// // 115200 BAUD, CLK=12MHz UCA0BR0 = 6; //this is working UCA0BR1 = 0; //this is working //*ours: UCBRF = 8, UCBRS = 0, UCOS16 = 1 // UCBRF = 11, UCBRS = 0, UCOS16 = 1 // BITS| 7 6 5 4 | 3 2 1 | 0 | // UCAxMCTL = | UCBRFx | UCBRSx | UCOS16 | UCA0MCTL = 0x81; //this works fine UCA0CTL1 &= ~UCSWRST; // Clear UCSWRST to enable USCI_A0-UART IFG2 |= UCA0TXIFG; // preset IFG flag always left on IE2|=UCA0RXIE; } #define TXSTRING(pnt) (TXdata((pnt), sizeof(pnt)-1)) // cool macro to get string and string len uartstruct uart; // declare a struct from typedef uartstruct void TXdata( char* pnt, unsigned int len){ uart.bufTXpnt = pnt; uart.TXbuflen = len; uart.bufRXpnt = uart.RXbuffer; // reset it to beginning of ram buffer IE2 |= UCA0TXIE + UCA0RXIE; // enable USCI_A0 TX & RX interrupt } //¦----------------------------- US0TX ISR ---------------------------------------¦ #pragma vector=USCIAB0TX_VECTOR __interrupt void USCIAB0TX(void) // Shared A0/B0 TX IRQ vector { if (IFG2 & UCA0TXIFG){ // check for UART TX if (uart.TXbuflen){ // if not zero UCA0TXBUF = *uart.bufTXpnt++; --uart.TXbuflen; } else IE2 &= ~UCA0TXIE; // suspend IE if zero } else IFG2 &= ~UCA0TXIFG; // clear a false UCB0 trigger } //¦----------------------------- US0RX ISR ---------------------------------------¦ #pragma vector=USCIAB0RX_VECTOR __interrupt void USCIAB0RX(void) // A0/B0 RX IRQ vector { if (IFG2 & UCA0RXIFG){ // check for UART RX *uart.bufRXpnt++ = UCA0RXBUF; // copy data byte if (uart.bufRXpnt == uart.RXbuffer+8 && uart.RXbuffer[0]==0xBB) // got 8 bytes in yet? <<<< uart.RXbuflen=uart.RXbuffer[1]; __bic_SR_register_on_exit(LPM0_bits); // wakeup main <<<< } else IFG2 &= ~UCA0RXIFG; } //¦----------------------------- Main -------------------------------------------¦ void main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop the Watch dog setMSP430Pins(); set_UCS(); uart_init(); // The following is OK to get the sensors activated and getting the data TXSTRING("\xAA\x00\x3E\x01\x00"); // Normal Power mode TXSTRING("\xAA\x00\x3D\x01\x07"); // Send this to the BNO055 to set up the AMG mode TXSTRING("\xAA\x01\x08\x06"); __bis_SR_register(LPM3_bits + GIE); } #include "msp430g2553.h" char xLSB; char xMSB; char yLSB; char yMSB; char zLSB; char zMSB; typedef struct uart // UART { char *bufTXpnt; // UART TX buffer pointer unsigned int TXbuflen; // the lenght of TX block char *bufRXpnt; // UART RX buffer pointer unsigned int RXbuflen; // the lenght of RX block char TXbuffer[20]; char RXbuffer[20]; } uartstruct; void setMSP430Pins() { //--------- Setting the UART function for P1.1 & P1.2 --------// P1SEL |= BIT1 + BIT2; // P1.1 UCA0RXD input P1SEL2 |= BIT1 + BIT2; // P1.2 UCA0TXD output return; } void set_UCS() { //------------------- Configure the Clocks -------------------// // DCOCTL = 0; // Select lowest DCOx and MODx settings BCSCTL1 = CALBC1_12MHZ; // Set range DCOCTL = CALDCO_12MHZ; // Set DCO step + modulation } void uart_init(void){ IE2 &= ~(UCA0TXIE | UCA0RXIE | UCB0TXIE | UCB0RXIE); // Disable all USCIx0 TX & RX interrupts UCA0CTL1|=UCSWRST; UCA0CTL1|= UCSSEL_2; //------------ Configuring the UART(USCI_A0) ----------------// // 115200 BAUD, CLK=12MHz UCA0BR0 = 6; //this is working UCA0BR1 = 0; //this is working //*ours: UCBRF = 8, UCBRS = 0, UCOS16 = 1 // UCBRF = 11, UCBRS = 0, UCOS16 = 1 // BITS| 7 6 5 4 | 3 2 1 | 0 | // UCAxMCTL = | UCBRFx | UCBRSx | UCOS16 | UCA0MCTL = 0x81; //this works fine UCA0CTL1 &= ~UCSWRST; // Clear UCSWRST to enable USCI_A0-UART IFG2 |= UCA0TXIFG; // preset IFG flag always left on IE2|=UCA0RXIE; ///today added } #define TXSTRING(pnt) (TXdata((pnt), sizeof(pnt)-1)) // cool macro to get string and string len uartstruct uart; // declare a struct from typedef uartstruct void TXdata( char* pnt, unsigned int len){ uart.bufTXpnt = pnt; uart.TXbuflen = len; uart.bufRXpnt = uart.RXbuffer; // reset it to beginning of ram buffer IE2 |= UCA0TXIE + UCA0RXIE; // enable USCI_A0 TX & RX interrupt } //¦----------------------------- US0TX ISR ---------------------------------------¦ #pragma vector=USCIAB0TX_VECTOR __interrupt void USCIAB0TX(void) // Shared A0/B0 TX IRQ vector { if (IFG2 & UCA0TXIFG){ // check for UART TX if (uart.TXbuflen){ // if not zero UCA0TXBUF = *uart.bufTXpnt++; --uart.TXbuflen; } else IE2 &= ~UCA0TXIE; // suspend IE if zero } else IFG2 &= ~UCA0TXIFG; // clear a false UCB0 trigger } //¦----------------------------- US0RX ISR ---------------------------------------¦ #pragma vector=USCIAB0RX_VECTOR __interrupt void USCIAB0RX(void) // A0/B0 RX IRQ vector { if (IFG2 & UCA0RXIFG){ // check for UART RX *uart.bufRXpnt++ = UCA0RXBUF; // copy data byte if (uart.bufRXpnt == uart.RXbuffer+8 && uart.RXbuffer[0]==0xBB) // got 8 bytes in yet? <<<< uart.RXbuflen=uart.RXbuffer[1]; } else IFG2 &= ~UCA0RXIFG; } //¦----------------------------- Main -------------------------------------------¦ void main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop the Watch dog //uart.RXbuflen=8; setMSP430Pins(); set_UCS(); uart_init(); while(1){ // The following is OK to get the sensors activated and getting the data TXSTRING("\xAA\x00\x3E\x01\x00"); // Normal Power mode TXSTRING("\xAA\x00\x3D\x01\x07"); // Send this to the BNO055 to set up the AMG mode TXSTRING("\xAA\x01\x08\x06"); __bis_SR_register(LPM3_bits + GIE); } }
Hi,
I'm trying to configure the clock with an external 32KHz crystal. Here is the code
/* Configure CPU clock for 16MHz */
// Initialize LFXT1
P5OUT &= 0x03;
P5DIR &= ~(BIT0 + BIT1);
P5SEL |= 0x03; // Select XT1
UCSCTL6 |= XCAP_3; // Internal load cap
// Loop until XT1 fault flag is cleared
do {
UCSCTL7 &= ~XT1LFOFFG; // Clear XT1 fault flags
} while (UCSCTL7 & XT1LFOFFG); // Test XT1 fault flag
__bis_SR_register(SCG0); // Disable the FLL control loop
UCSCTL0 = 0x0000; // Set lowest possible DCOx, MODx
UCSCTL1 = DCORSEL_5; // Select DCO range 16MHz operation
UCSCTL2 = FLLD__1 | 487; // Set FLL loop divider to 2 and
// required DCO multiplier
__bic_SR_register(SCG0); // Enable the FLL control loop
// Worst-case settling time for the DCO when changing the DCO range bits is:
// 32 x 32 x MCLK / ACLK
__delay_cycles(((32 * 16 * 1000000) / 0x8000) * 32);
// Loop until XT1,XT2 & DCO fault flag is cleared
do {
UCSCTL7 &= ~(XT2OFFG + XT1LFOFFG + XT1HFOFFG + DCOFFG);
// Clear XT2,XT1,DCO fault flags
SFRIFG1 &= ~OFIFG; // Clear fault flags
} while (SFRIFG1 & OFIFG); // Test oscillator fault flag
I have ACLK (sourced by XT1 as default) clock output on one of the output pins and I can measure the clock frequency with a scope. I have two issues:
1. The frequency doesn't seems to be very stable as I would expect from a clock crystal with 20ppm. The scope is giving me alternate values 32.67-32.78 KHz
2. As you may notice I'm using internal load caps :
UCSCTL6 |= XCAP_3;
which gives 12pF load. The crystal needs 12.5pF, I assume it's still correct since the parasitic capacitance could vary anyway. The problem is that if I change in the code XCAP_3 with XCAP_0 (which gives 2pf load instead of 12) nothing seems to happen. I would expect that the measured frequency gets a significant change. Is it something wrong with the code?
P.S. I don't have external capacitors mounted. My understanding is that if the crystal asks 12.5 pf load capacitance I can use the internal capacitance that gives me 12pf so no external capacitors are needed,
Thanks,
Dragos
hi,
I am a newcomer to msp430 platform.I am trying to implement a project in which timerb0 controls sampling sequence of adc12.
Timerb0 works in upmode and in the first half of the period a pulse is generated and when CCR1 hits the half period pulse is stopped.
What I want to do is start sampling after certain clock cycles when the pulse is stopped.Following is my code.My problem is adc12 isr is never triggered .
I would like to load a text file into unused flash in an MSP430F5529. The text file is intended to serve as documentation for the device, which can send it out a serial port on demand. It seems like converting the text and downloading it in TI-TXT format would be an easy way to do this, but I haven't found a way to do it. Is anything like this possible?
Hi,
I am in process of implementing MPPT based charge controller and thus have gone through the TI reference design PMP7605.
Some part of the code used in reference design is NOT clear to me.
I am using lead acid battery and normally these types of battery should be charged in 3 steps.
<1> Constant Current <2> Constant Voltage and <3> Reduced Constant voltage i.e. Float charge
Switching from one mode to other depends on threshold voltage and type of battery used.
MPPT Part is clear to me but once battery threshold is reached for 2nd step, i am feeling difficulty in understanding the code for 2nd and 3rd step as i am NOT able to correlate it with the theory.
Code is written below:
/**********************Needs to be changed with different Batteries************************************/
unsigned int CC_LIMIT = 300; // 210 - 10A, 300 - 15A, 350 - 20A
unsigned int CC_TO_CV_LIMIT = 305 ; // 305 - 14.2 , 610 - 28.4
unsigned int FLOAT_VOLTAGE = 295 ; // 295 - 13.8 , 590 - 27.6
unsigned int BATTERY_CUTOFF = 220 ; // 220 - 10.2 , 440 - 20.4
unsigned int BATTERY_RECONNECT = 240; // 240 - 11.2 , 480 - 22.4
/******************************************************************************************************/
/* Once CC limit or CC_To_CV_limit are exceeded,variable MPPT_Loop is reset and there after this function will be called instead of MPPT function
* Here duty is adjusted such that CC_Limit,CC_To_CV_Limit,Float voltage are all maintained according to the battery state */
void Battery_Charge_Profiling (void)
{
if ((Battery_Voltage <= CC_TO_CV_LIMIT)&& (!CV_Mode_ON))
{
if (Battery_Current < CC_LIMIT)
{
Duty--;
if (Duty < 30)
{
Duty = 30;
CC_Loop_Exit_Counter ++;
if (CC_Loop_Exit_Counter > LOOP_EXIT_LIMIT)
{
MPPT_Loop = 1;
MPP_Loop_Exit_Counter = 0;
CC_Loop_Exit_Counter = 0;
POB_Direction = 1;
Duty = 210;
}
}
}
else
{
Duty ++;
if (Duty > 680) Duty = 680;
CC_Loop_Exit_Counter = 0;
}
}
else
{
CV_Mode_ON = 1;
Charging_Voltage_Reqd = CC_TO_CV_LIMIT;
if (Battery_Voltage < Charging_Voltage_Reqd)
{
Duty--;
if (Duty < 30) Duty = 30;
}
else
{
Duty ++;
if (Duty > 680) Duty = 680;
}
if (Battery_Voltage < FLOAT_VOLTAGE - 20)
{
CC_Loop_Exit_Counter ++;
if (CC_Loop_Exit_Counter > LOOP_EXIT_LIMIT)
{
MPPT_Loop = 1;
MPP_Loop_Exit_Counter = 0;
CC_Loop_Exit_Counter = 0;
POB_Direction = 1;
Duty = 210;
}
}
}
}
NOTE: I am NOT able to understand the BOLD part of the code.
Please help.
I've been using the MSP430G2553 for a while without any problems.
Then suddenly it won't come out of reset. Turns out that the RST pin has suddenly a very low impedance to GND. I could still get it out of reset by using the programmer but then after a while the RST pin tied itself hard to GND.
I've replaced the chip with another one which thten worked for a short while. Then the same problem. It's again tied hard to GND.
Any ideas? It's been working fine before for months.
Hi,
I'm using cc430 timer capture mode to do some signal frequency measurement experiments.
I set up TA0 and CCR as following register values:
TA0CTL|=TACLR+TASSEL__TACLK+ID_0+MC__CONTINUOUS; TA0CCTL2|=CCIS_1+CAP+SCS+CM_1+CCIE; TA0CCTL3|=CCIS_1+CAP+SCS+CM_1+CCIE;
The Timer input is an external 10MHz clock source, CCR2|CCI2B input is ACLK/2 which is about 16kHz, CCR3|CCI3B input is GDO1 clk, which is about 135kHz.
The interrupt trigger a TA0CCRx register value reading on every 320 captures, which prolonged the measurement period. The interrupt service code is following:
static int Captures=0; static int Captures1=0; #define NCAPTURES 320 #define NCAPTURES1 320 #define FACLK 1.027//0.2925 #pragma vector=TIMER0_A1_VECTOR __interrupt void TimerA(void) { // TA0CTL|=TACLR;//TASSEL__INCLK+ID_0+MC__CONTINUOUS; switch(__even_in_range(TA0IV,8)) { case 4: switch(Captures){ case 0: starttime=TA0CCR2; Captures=NCAPTURES; break; case 1: num1=TA0CCR2; TA0CTL|=TACLR; Captures=0; sprintf(buffer1,"1 %lu\n",num1); putstr(buffer1); break; default: Captures--; break; } case 6: switch(Captures1){ case 0: starttime1=TA0CCR3; Captures1=NCAPTURES1; break; case 1: num2=TA0CCR3; TA0CTL|=TACLR; Captures1=0; sprintf(buffer2,"2 %lu\n",num2); putstr(buffer2); break; default: Captures1--; break; } default:break; } __bic_SR_register_on_exit(LPM3_bits); }
When I have only CCR2 enabled and CCR3 disabled, everything works fine. Once I enable CCR3 both capture interrupts works fine but the program trapped in the Timer interrupt and cannot jump back to the main loop. I am wondering why this happened, possible reason might be the frequency of CCR3 input is faster than the system main clock?
Thanks in advance!
Hi ,
Regarding to EVM430-F6736 Energy meter, I have a few problem here,
1, I can't use the PC Gui calibration in Slaa517. Any driver need? I using window 7. The Gui Close during open it.
2. Can we use converter rs232 to usb ?
Thanks regard ,
Khidhir
Hi,
I have a code used in MSP430F5438, I2C reading FOSX8700 absolutely fine. Then after I change the chip to MSP430F5635, It could not even read a byte from 8700.
I use UCB0 and interrupt. P2.1 as data and P2.2 as CLK, After MSP430F5438 sent out the I2C address, it do not have the /ACK back from 8700. However, I also try using Arduino I2C to send same address to 8700 ( same hardware baord), it does able to get /ACK back. That mean the 8700 board work fine. Just MSP430F5438 seem output high by itself on data bus.
Wonder if it need special setting in 5438 to let I2C work? That seem very strange?
Thanks in advance.
Hi all,
Do anyone know what happened if we use return statement inside isr.
isr()
{
some codes..;
return;
}
Also can we pass any arguments in isr function?
Iam designing a profibus PA temperature transmitter and I would like to use MSP432P401RIRGC because it has enough memory that I need and fit in my PCB area. But there is no sample and no date to have it in distribuitor. Can I consider MSP432P401RIRGC in my design to test next month?
Regards
Edson Emboaba
Hi,
I am generating 4 PWM signals of 50% dutycycle and 20kHz frequency using timer A0 and 8Mhz clock to the timer module. But I am getting fluctuation of around 120Hz periodicaly.
I am not able to identify the reason of it. Can any one please suggest a sollution to this problem? Why this is happening?
Below is the part of my code:-
intmain(void)
{
/* Set UCS clock system */
vUcsInitClock(); //ACLK is 8Mhz
P1DIR |= BIT2+BIT3+BIT4+BIT5; // P1.2 and P1.3 output
P1SEL |= BIT2+BIT3+BIT4+BIT5; // P1.2 and P1.3 options select
TA0CCR0 = 399; // PWM Period
TA0CCTL1 = OUTMOD_7; // CCR1 reset/set
TA0CCR1 = 199; // CCR1 PWM duty cycle
TA0CCTL2 = OUTMOD_7; // CCR2 reset/set
TA0CCR2 = 199; // CCR2 PWM duty cycle
TA0CCTL3 = OUTMOD_7; // CCR1 reset/set
TA0CCR3 = 199; // CCR1 PWM duty cycle
TA0CCTL4 = OUTMOD_7; // CCR2 reset/set
TA0CCR4 = 199; // CCR2 PWM duty cycle
TA0CTL = TASSEL_1 + MC_1 + TACLR; // ACLK, up mode, clear TAR
}