Part Number:MSP432P401R
Bluetooth module MRDY and SRDY configuration when P6.0 and P2.5 are low level to communicate, why in the code GPIO initialization set to high level.
Part Number:MSP432P401R
Bluetooth module MRDY and SRDY configuration when P6.0 and P2.5 are low level to communicate, why in the code GPIO initialization set to high level.
Part Number:EVM430-FR6047
Tool/software: Code Composer Studio
Hi,
I am new to using timer.I did go through the example codes given by TI,but i couldnt generate a 1 sec delay using timer since the max.value i can count upto is 65535.
Could i get some help on how to generate a i sec delay using interrupt.
Regards,
Divya Hari
Part Number:MSP430F1611
Tool/software: TI C/C++ Compiler
Hi,
I am using MSPF1611 and I want to communicate it using SPI communication and it working well using the PIN no. P3.1, P3.2, and P3.3, now my problem is how I can use PIN no. 5.1, 5.2 and 5.3 instead of P3.x.
I changed the " P3SEL = 0x00E;" to " P5EL = 0x00E;" but it dos't work.
How to do this?????
The complete code is:
#include <msp430.h> char MST_Data = 0x39; unsigned int j; unsigned int i; int main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop WDT // P3DIR =0x001; P3SEL = 0x00E; // Setup P3 for SPI mode //P5SEL =0x00E; // U0CTL = (0x0070u) /* USART 0 Control */ // CHAR = (0x10) /* Data 0:7-bits / 1:8-bits */ // SYNC = (0x04) /* UART / SPI mode */ // MM = (0x02) /* Master Mode off/on */ U0CTL = CHAR + SYNC + MM + SWRST; // 8-bit, SPI, Master U0TCTL = CKPH + SSEL1 + STC; // Polarity, SMCLK, 3-wire // U0BR0 = (0x0074u) /* USART 0 Baud Rate 0 */ // U0BR0 = 0x064; // SPICLK = SMCLK/2 // U0BR1 = (0x0075u) /* USART 0 Baud Rate 1 */ U0BR1 = 0x000; // UMCTL0 = U0MCTL /* USART 0 Modulation Control */ reg name U0MCTL = 0x000; // ME1 = (0x0004u) /* Module Enable 1 */ ME1 = USPIE0; // Module enable U0CTL &= ~SWRST; // SPI enable IE1 |= URXIE0; // Recieve interrupt enable __enable_interrupt(); // Enable interrupts //TXBUF0 = 0x00; i = 50000; // Delay do (i--); while (i != 0); { TXBUF0 = MST_Data; // Transmit first character LPM0; // CPU off } } // End Main #if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__) #pragma vector=USART0RX_VECTOR __interrupt void SPI0_rx (void) #elif defined(__GNUC__) void __attribute__ ((interrupt(USART0RX_VECTOR))) SPI0_rx (void) #else #error Compiler not supported! #endif { j = 5000; // Delay do (j--); while (j != 0); TXBUF0 = MST_Data; /* j = 10000; // Delay do (j--); while (j != 0); TXBUF0 =0x34; j = 10000; // Delay do (j--); while (j != 0); TXBUF0 =0x56; j = 10000; // Delay do (j--); while (j != 0); TXBUF0 =0x78; j = 10000; // Delay do (j--); while (j != 0); TXBUF0 =0x9A; */ //TXBUF0 =0xab; // TXBUF0 =0xbb; //P3OUT =0x00; }
Part Number:MSP430F5438A
Hi TI team,
I am trying to send data through I2C in MSP430F5438A. I am using example code given by the TI.
It get hanged, once the first byte is placed in TX buffer.
By using breakpoint it goes upto ISR -> UCB0TXBUF = TXData; // Load TX buffer, after this code get hanged.
Please help me to solve the issue.
Code Used:
#include <msp430.h>
unsigned char TXData;
unsigned char TXByteCtr;
int main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
P3SEL |= 0x06; // Assign I2C pins to USCI_B0
UCB0CTL1 |= UCSWRST; // Enable SW reset
UCB0CTL0 = UCMST + UCMODE_3 + UCSYNC; // I2C Master, synchronous mode
UCB0CTL1 = UCSSEL_2 + UCSWRST; // Use SMCLK, keep SW reset
UCB0BR0 = 12; // fSCL = SMCLK/12 = ~100kHz
UCB0BR1 = 0;
UCB0I2CSA = 0xAA; // Slave Address is 048h
UCB0CTL1 &= ~UCSWRST; // Clear SW reset, resume operation
UCB0IE |= UCTXIE; // Enable TX interrupt
TXData = 0x01; // Holds TX data
while (1)
{
TXByteCtr = 1; // Load TX byte counter
while (UCB0CTL1 & UCTXSTP); // Ensure stop condition got sent
UCB0CTL1 |= UCTR + UCTXSTT; // I2C TX, start condition
__bis_SR_register(LPM0_bits + GIE); // Enter LPM0 w/ interrupts
__no_operation(); // Remain in LPM0 until all data
// is TX'd
TXData++; // Increment data byte
}
}
//------------------------------------------------------------------------------
// The USCIAB0_ISR is structured such that it can be used to transmit any
// number of bytes by pre-loading TXByteCtr with the byte count.
//------------------------------------------------------------------------------
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector = USCI_B0_VECTOR
__interrupt void USCI_B0_ISR(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(USCI_B0_VECTOR))) USCI_B0_ISR (void)
#else
#error Compiler not supported!
#endif
{
switch(__even_in_range(UCB0IV,12))
{
case 0: break; // Vector 0: No interrupts
case 2: break; // Vector 2: ALIFG
case 4: break; // Vector 4: NACKIFG
case 6: break; // Vector 6: STTIFG
case 8: break; // Vector 8: STPIFG
case 10: break; // Vector 10: RXIFG
case 12: // Vector 12: TXIFG
if (TXByteCtr) // Check TX byte counter
{
UCB0TXBUF = TXData; // Load TX buffer
TXByteCtr--; // Decrement TX byte counter
}
else
{
UCB0CTL1 |= UCTXSTP; // I2C stop condition
UCB0IFG &= ~UCTXIFG; // Clear USCI_B0 TX int flag
__bic_SR_register_on_exit(LPM0_bits); // Exit LPM0
}
break;
default: break;
}
}
Thanks
Siva B
Part Number:MSP430G2553
Tool/software: Code Composer Studio
Hi. I was trying to my new project cod yesterday. I debugged my code.Than when the code was working correctly, my css couldn^t respond and ı have to terminate it. A few minutes later i tried debug my code again. But ı saw
Error initializing emulator:
No USB FET was found
I tried
the other usb ports.
Reset my computer.
uninstall my ccs.
But ı got this error still. My msp was new. Also ccs is updated. Please help me. I ll miss to deadline of my project.
Part Number:EVM430-FR6047
Hello,
I'm developing a Water Meter, and for the prototipe I'm using the EVM430-FR6047 board, with USSLib library. For some weeks, I've been working on calibrating the device, but it doesn't matter what I do, the measured flow still is not as fixed as I would like, the value changes a lot.
Is there a "correct" way to calibrate it? Or some guide I haven't found just yet?
Thanks.
Part Number:MSP430FR2311
Tool/software: Code Composer Studio
I'm wanting to use the MSP430 as an I2C slave and noticed the demo: "msp430fr231x_eusci_i2c_standard_slave.c" appears to have some confusing GPIO configuration for the I2C pins.
The code configures P1.2 and P1.3 to their primary functions (P1SEL0 = 1 and P1SEL1 = 0), but according to Table 8.3 in SLAU445h and Table 4.1 in the datasheet we need to select the secondary function for I2C to P1.2 and P1.3
This seems like an error. Can someone verify?
Part Number:MSP432P401R
Tool/software: Code Composer Studio
Hi All,
My goal was to generate an output on Pin P6.7 with a frequency at 500kHz. However, after many attempts of changing some parameters, I can only get a maximum frequency at around 268kHz. How would I go about correcting this?
This is my first time coming back to the MSP432 after a year break so I have gotten rusty; I tried reviewing datasheets and manuals but am still stuck. (And also my first post here)
(Please visit the site to view this file)
Any insight would be much appreciated.
Regards,
Jenna
Part Number:MSP432P401R
I had my code working perfectly fine. It still works and runs fine, except now my ADC values are garbage and mean absolutely nothing. I have been testing with P4.7, but wanted to test my idle state so I connected P4.1-4.6 to 5[V] that way their reading would be high and not cause the interrupt so i could isolate it to P4.7. Once i did this all of my values just do random things. I disconnected all pins and connected only P4.7 and now all ADC results are just random super large numbers or small or just anything. I move hand far and close to my sonar sensors and the ADC readings give no form of pattern or logical reading. I know the code works perfectly fine because I was running it for hours testing things and it was all perfect. I would just like to know if anyone can help me figure out what i did when I connected all those pins to the 5[V] and how I can reverse it. To run my code open: Resource Explorer > MSP432P401R LaunchPad - Red 2.x (Red) > SimpleLink MSP432P4 SDK - v:2.30.00.14 > Examples > Development Tools > MSP432P401R LaunchPad - Red 2.x (Red) > DriverLib > adc14_single_conversion_repeat_timera_source > No RTOS > CCS Compiler > Import project to IDE
and copy paste my code it will run fine.
/* DLUG = MSP432_DriverLib_Users_Guide-MSP432P4xx-2_20_00_08 */ /* hold command and click any API to see information about it */ /* DriverLib Includes */ #include <ti/devices/msp432p4xx/driverlib/driverlib.h> /* Standard Includes */ #include <stdint.h> #include <stdbool.h> /* For usleep() */ //#include <unistd.h> //#include <stddef.h> /* TI-RTOS Header files */ #include <ti/drivers/GPIO.h> //#include <ti/display/Display.h> /* Board Header file */ //#include "Board.h" /* Statics */ uint16_t resultsBuffer[7];//Buffer to hold ADC readings of each Sonar Sensor /* DLUG section: 2.6.2.25 | Registers an interrupt handler for the ADC interrupt. */ void ADC14_registerInterrupt(void (*ADC14_IRQHandler)(void)); void PWMConfigure(void);//set up PWM void ADCConfigure(void);//set up ADC void InitDCO(void);//Change operation frequency of DCO void SonarOne(void); void SonarTwo(void); void SonarThree(void); void SonarFour(void); void SonarFive(void); void SonarSix(void); void SonarSeven(void); void EmergencyStop(void); /**********************Timer_A PWM Configuration Parameter for Right motor********************* *hold command and click Timer_A_PWMConfig to see that pwmConfigR is a typedef struct _Timer_A_PWMConfig *S1 is for right motor */ Timer_A_PWMConfig pwmConfigR = { TIMER_A_CLOCKSOURCE_SMCLK,//clock source for PWM operation TIMER_A_CLOCKSOURCE_DIVIDER_1,//divider of clocksource SMCLK 4800,//period TIMER_A_CAPTURECOMPARE_REGISTER_3, TIMER_A_OUTPUTMODE_RESET_SET, 2400//start at 50% duty cycle of 5[V] (2.5[V]) so motors not moving. }; /**********************Timer_A PWM Configuration Parameter for Left motor********************* *S2 is for left motor*/ Timer_A_PWMConfig pwmConfigL = { TIMER_A_CLOCKSOURCE_SMCLK, TIMER_A_CLOCKSOURCE_DIVIDER_1, 4800, TIMER_A_CAPTURECOMPARE_REGISTER_4,//makes P2.7 work because TA0.4 TIMER_A_OUTPUTMODE_RESET_SET, 2400 }; /*********************************END TIMER_A_PWMConfig FOR BOTH MOTORS ********************************* * The motors work with direction and speed as one input. 51-100% duty cycle is forward speed (5[V] max, * higher duty cycle is faster forward speed), 0-49% duty cycle is backward speed (0[V] max, lower duty * cycle is faster backward speed) and 50% is no movement(2.5[V]). * * We want to use about half of each directions duty cycle since we do not want to go fast. Each direction * has 2,400 levels of speed. Half of each is 1,200 levels of speed. Forward can have a duty cycle of * 2,401-4,800 and backwards can have a duty cycle of 0 - 2,399. We will be using Forward: 2,401-3,600 & * Backward: 1,200 - 2,399 */ /*********************************START MAIN**********************************/ int main(void) { /* Halting WDT */ MAP_WDT_A_holdTimer(); PWMConfigure();//set up PWM ADCConfigure();//set up ADC MAP_Interrupt_enableSleepOnIsrExit(); /* Going to sleep */ while (1) { MAP_PCM_gotoLPM0();//sleep while no interrupts are happening. } }//END MAIN /*********************************END MAIN**********************************/ void SonarOne(void){//P4.1 & resultsBuffer[6] MAP_GPIO_setOutputHighOnPin(GPIO_PORT_P1, GPIO_PIN0);//LED1 (left) MAP_GPIO_setOutputLowOnPin(GPIO_PORT_P2, GPIO_PIN1); } void SonarTwo(void){//P4.2 & resultsBuffer[5] MAP_GPIO_setOutputHighOnPin(GPIO_PORT_P2, GPIO_PIN1);//LED2 (right) MAP_GPIO_setOutputLowOnPin(GPIO_PORT_P1, GPIO_PIN0); } void SonarThree(void){//P4.3 & resultsBuffer[4] } void SonarFour(void){//P4.4 & resultsBuffer[3] } void SonarFive(void){//P4.5 & resultsBuffer[2] } void SonarSix(void){//P4.6 & resultsBuffer[1] } void SonarSeven(void){//P4.7 & resultsBuffer[0] } /*********************************START ADC HANDLER**********************************/ /* This interrupt is fired whenever a Sonar Reading is whatever the comparator says and the MAP_ADC14_enableInterrupt(X) says. */ void ADC14_IRQHandler(void) { uint64_t status; status = MAP_ADC14_getEnabledInterruptStatus();//gets interrupt status for comparison MAP_ADC14_clearInterruptFlag(status);//clears interrupt flag for next interrupt check if(status & ADC_LO_INT) { // MAP_ADC14_getMultiSequenceResult(resultsBuffer); resultsBuffer[0] = MAP_ADC14_getResult(ADC_MEM0);//P4.7 resultsBuffer[1] = MAP_ADC14_getResult(ADC_MEM1);//P4.6 resultsBuffer[2] = MAP_ADC14_getResult(ADC_MEM2);//P4.5 resultsBuffer[3] = MAP_ADC14_getResult(ADC_MEM3);//P4.4 resultsBuffer[4] = MAP_ADC14_getResult(ADC_MEM4);//P4.3 resultsBuffer[5] = MAP_ADC14_getResult(ADC_MEM5);//P4.2 resultsBuffer[6] = MAP_ADC14_getResult(ADC_MEM6);//P4.1 } if ((resultsBuffer[0] < 550) || (resultsBuffer[1] < 550) || (resultsBuffer[2] < 550) || (resultsBuffer[3] < 550) || (resultsBuffer[4] < 550) || (resultsBuffer[6] < 550) ){//LED 1 ON WHEN OBJECTS ARE CLOSE (RED) SonarOne(); } else{//LED 2 ON WHEN OBJECTS ARE FAR (GREEN) SonarTwo(); } }//END ADC14 INTERRUPT HANDLER /*********************************END ADC HANDLER**********************************/ /*********************************START PORT 1 HANDLER**********************************/ /* Port1 ISR - This ISR will progressively step up the duty cycle of the PWM * on a button press */ void PORT1_IRQHandler(void) { uint32_t status = MAP_GPIO_getEnabledInterruptStatus(GPIO_PORT_P1);//P2.7 brown wire MAP_GPIO_clearInterruptFlag(GPIO_PORT_P1, status); if (status & GPIO_PIN1) { if(pwmConfigL.dutyCycle == 4800 && pwmConfigR.dutyCycle == 4800){ pwmConfigL.dutyCycle = 480; pwmConfigR.dutyCycle = 480;} else{ pwmConfigL.dutyCycle += 480; pwmConfigR.dutyCycle += 480;} MAP_Timer_A_generatePWM(TIMER_A0_BASE, &pwmConfigL); } }//END PORT 1 INTERRUPT HANDLER /*********************************END PORT 1 HANDLER**********************************/ /*********************************START PWM CONFIGURE**********************************/ void PWMConfigure(){ InitDCO();//Change clock frequency to 48[MHz] /* DLUG section: 6.6.2.18 | Initialize SMCLK to DCOCLK frequency divided by 1*/ MAP_CS_initClockSignal(CS_SMCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_1); /* Configuring GPIO2.7 as peripheral output for PWM for right motor and * Configuring GPIO2.6 as peripheral output for PWM for left motor and P1.1 for button interrupt */ MAP_GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_P2, GPIO_PIN7, GPIO_PRIMARY_MODULE_FUNCTION);//P2.7 (right motor) MAP_GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_P2, GPIO_PIN6, GPIO_PRIMARY_MODULE_FUNCTION);//P2.6 (left motor) MAP_GPIO_setAsInputPinWithPullUpResistor(GPIO_PORT_P1, GPIO_PIN1);//set Pin 1 on Port 1 MAP_GPIO_clearInterruptFlag(GPIO_PORT_P1, GPIO_PIN1); MAP_GPIO_enableInterrupt(GPIO_PORT_P1, GPIO_PIN1); // Interrupt_setPriority(INT_PORT1,0); /* DLUG section: 12.4.2.4 | Enabling interrupts on port 1 for button */ MAP_Interrupt_enableInterrupt(INT_PORT1); /* DLUG section: 24.4.2.11 | Generate a PWM with timer running in up mode. Clock is set at 48[MHz], * which is 0.0208333[us] [Microseconds] (2.08s*10^-8). Each Timer is set up with a period of 4,800 * ticks so period is 0.0001[s] which is a frequency of 1/.0001 = 10[kHz] */ MAP_Timer_A_generatePWM(TIMER_A0_BASE, &pwmConfigR); MAP_Timer_A_generatePWM(TIMER_A0_BASE, &pwmConfigL); }//END PWM CONFIGURATION /*********************************END PWM CONFIGURE**********************************/ /*********************************START ADC CONFIGURE**********************************/ void ADCConfigure(){ /* DLUG section: 2.6.2.14 | This will enable operation of the ADC block. */ MAP_ADC14_enableModule(); // MAP_ADC14_initModule(ADC_CLOCKSOURCE_ADCOSC, ADC_PREDIVIDER_1, ADC_DIVIDER_1, // 0); /* Configuring GPIOs for Tertiary Function and inputs on Port 4 Pins 1-7 inclusive */ MAP_GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P4, GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 , GPIO_TERTIARY_MODULE_FUNCTION); /* Setting LED1 and LED2 on board as outputs and initializing them as low */ MAP_GPIO_setAsOutputPin(GPIO_PORT_P1, GPIO_PIN0); MAP_GPIO_setOutputLowOnPin(GPIO_PORT_P1, GPIO_PIN0);//LED1(left and red) MAP_GPIO_setAsOutputPin(GPIO_PORT_P2, GPIO_PIN1); MAP_GPIO_setOutputLowOnPin(GPIO_PORT_P2, GPIO_PIN1);//LED2(right and green) // MAP_GPIO_setAsOutputPin(GPIO_PORT_P2, GPIO_PIN2); /* DLUG section: 2.6.2.3 | Configuring ADC Memory (ADC_MEM0 - ADC_MEM6 (A6 - A12) with no repeat) * with internal 3.3[V] reference */ MAP_ADC14_configureMultiSequenceMode(ADC_MEM0,ADC_MEM6, true); /* DLUG section: 2.6.2.2 | Configures individual memory locations for each ADC module. * (memory locations, type of voltage reference, which channel is being used for * ADC sampling, false for non-differential inputs) */ //ADC_VREFPOS_INTBUF_VREFNEG_VSS (does 2.5[V] reference voltage) MAP_ADC14_configureConversionMemory(ADC_MEM0, ADC_VREFPOS_AVCC_VREFNEG_VSS, ADC_INPUT_A6, false);//ADC6 = P4.7 = MEM0 MAP_ADC14_configureConversionMemory(ADC_MEM1, ADC_VREFPOS_AVCC_VREFNEG_VSS, ADC_INPUT_A7, false);//ADC7 = P4.6 = MEM1 MAP_ADC14_configureConversionMemory(ADC_MEM2, ADC_VREFPOS_AVCC_VREFNEG_VSS, ADC_INPUT_A8, false);//ADC8 = P4.5 = MEM2 MAP_ADC14_configureConversionMemory(ADC_MEM3, ADC_VREFPOS_AVCC_VREFNEG_VSS, ADC_INPUT_A9, false);//ADC9 = P4.4 = MEM3 MAP_ADC14_configureConversionMemory(ADC_MEM4, ADC_VREFPOS_AVCC_VREFNEG_VSS, ADC_INPUT_A10, false);//ADC10 = P4.3 = MEM4 MAP_ADC14_configureConversionMemory(ADC_MEM5, ADC_VREFPOS_AVCC_VREFNEG_VSS, ADC_INPUT_A11, false);//ADC11 = P4.2 = MEM5 MAP_ADC14_configureConversionMemory(ADC_MEM6, ADC_VREFPOS_AVCC_VREFNEG_VSS, ADC_INPUT_A12, false);//ADC12 = P4.1 = MEM6 /* DLUG section: 2.6.2.16 | Setting up the sample timer to automatically step through the sequence convert * After one sample/convert is finished, the ADC module will automatically continue on to the next sample.*/ MAP_ADC14_enableSampleTimer(ADC_AUTOMATIC_ITERATION); /*DLUG section: 2.6.2.11 | Enables the specified mask of memory channels to use the specified comparator window. The ADCC module has two different comparator windows that can be set with this function.*/ ADC14_enableComparatorWindow(ADC_MEM0 | ADC_MEM1 | ADC_MEM2 | ADC_MEM3 | ADC_MEM4 | ADC_MEM5 | ADC_MEM6, ADC_COMP_WINDOW0); // ADC14_enableComparatorWindow(ADC_MEM0 | ADC_MEM1 | ADC_MEM2 | ADC_MEM3 | ADC_MEM4 | ADC_MEM5 | ADC_MEM6, // ADC_COMP_WINDOW1); /* DLUG section: 2.6.2.26 | Sets the lower and upper limits of the specified window comparator. * (window 0 or 1, lower limit, upper limit) */ ADC14_setComparatorWindowValue(ADC_COMP_WINDOW0,550, 2000); // ADC14_setComparatorWindowValue(ADC_COMP_WINDOW1,550, 2000); /* DLUG section: 2.6.2.13 | Enabling the interrupt when a channel drops below threshold of comparator, * if use ADC_HI_INT enables interrupt when channel goes above threshold of comparator or * ADC_IN_INT enables interrupt channel when channel is whithin threshold */ MAP_ADC14_enableInterrupt(ADC_LO_INT); // MAP_ADC14_enableInterrupt(ADC_HI_INT); // MAP_ADC14_enableInterrupt(ADC_IN_INT); /* DLUG section: 12.4.2.4 - 12.4.2.5 | Enabling Interrupts */ MAP_Interrupt_enableInterrupt(INT_ADC14); // Interrupt_setPriority(INT_ADC14,0); MAP_Interrupt_enableMaster(); /* DLUG section: 2.6.2.12 & 2.6.2.32 | Enables conversion of ADC data. Triggering the start of the sample. * Toggles the trigger for conversion of the ADC module by toggling the trigger software bit.*/ MAP_ADC14_enableConversion(); MAP_ADC14_toggleConversionTrigger(); }//END ADC CONFIGURATION /*********************************END ADC CONFIGURE**********************************/ /*********************************START DCO INIT**********************************/ void InitDCO() { /* DLUG section: 9.3.2.4 | Enables the floating-point unit. */ FPU_enableModule(); /* DLUG section: 14.7.2.16 | Sets the core voltage level (Vcore). The function will * take care of all power state transitions needed to shift between core voltage levels. * Before we start we have to change VCORE to 1 to support the 48MHz frequency */ PCM_setCoreVoltageLevel(PCM_AM_LDO_VCORE1); /* DLUG section: 8.4.2.22 | Changes the number of wait states that are used by the flash * controller for read operations. When changing frequency ranges of the clock, this * functions must be used in order to allow for readable flash memory.*/ FlashCtl_setWaitState(FLASH_BANK0, 1); FlashCtl_setWaitState(FLASH_BANK1, 1); /* DLUG section: 6.6.2.21 | Sets the centered frequency of DCO operation to [32MHz to 64MHz]. */ MAP_CS_setDCOCenteredFrequency(CS_DCO_FREQUENCY_48); /* DLUG section: 9.3.2.1 | Disables the floating-point unit. */ FPU_disableModule(); }//END DCO INITIALIZATION /*********************************END DCO INIT**********************************/ /*********************************START EMERGENCY STOP**********************************/ void EmergencyStop(){ pwmConfigL.dutyCycle = 2400; pwmConfigR.dutyCycle = 2400; } /*********************************END EMERGENCY STOP**********************************/
Part Number:EVM430-FR6047
Tool/software: Code Composer Studio
Hi,
I have written the code such that after exiting the timer loop it should transmit data.But unfortunately,the program does not return from ISR even after i have disabled.
Can i get some help?
int main(void) { WDTCTL = WDTPW | WDTHOLD; // stop watchdog timer timer(); // calling UART via timer ISR SerialComm(visual); }
int timer(void) { WDTCTL = WDTPW | WDTHOLD; // Stop WDT P1OUT &= ~BIT0; P1DIR |= BIT0; PJSEL0 = BIT4 | BIT5; // Initialize LFXT pins // Disable the GPIO power-on default high-impedance mode to activate // previously configured port settings PM5CTL0 &= ~LOCKLPM5; // Configure LFXT 32kHz crystal CSCTL0_H = CSKEY_H; // Unlock CS registers CSCTL4 &= ~LFXTOFF; // Enable LFXT do { CSCTL5 &= ~LFXTOFFG; // Clear LFXT fault flag SFRIFG1 &= ~OFIFG; } while (SFRIFG1 & OFIFG); // Test oscillator fault flag CSCTL0_H = 0; // Lock CS registers // Setup RTC Timer RTCCTL0_H = RTCKEY_H; // Unlock RTC RTCCTL0_L = RTCTEVIE_L; // RTC event interrupt enable RTCCTL13 = RTCSSEL_2 | RTCTEV_0 | RTCHOLD; // Counter Mode, RTC1PS, 8-bit ovf RTCPS0CTL = RT0PSDIV1; // ACLK, /8 RTCPS1CTL = RT1SSEL1 | RT1PSDIV0 | RT1PSDIV1; // out from RT0PS, /16 RTCCTL13 &= ~(RTCHOLD); // Start RTC __bis_SR_register(LPM3_bits | GIE); // Enter LPM3 mode w/ interrupts enabled __no_operation(); return 0; } /*****************************************************************************************************/ //ISR for Transmission Timer /*************************************************************************************************/ #if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__) #pragma vector=RTC_C_VECTOR __interrupt void RTC_ISR(void) #elif defined(__GNUC__) void __attribute__ ((interrupt(RTC_C_VECTOR))) RTC_ISR (void) #else #error Compiler not supported! #endif { switch(__even_in_range(RTCIV, RTCIV__RT1PSIFG)) { case RTCIV__NONE: break; // No interrupts case RTCIV__RTCOFIFG: break; // RTCOFIFG case RTCIV__RTCRDYIFG: break; // RTCRDYIFG case RTCIV__RTCTEVIFG: // RTCEVIFG SerialComm_TxString1(b); RTCCTL0_L ^= RTCTEVIE_L ; // RTC interrupt disable break; case RTCIV__RTCAIFG: break; // RTCAIFG case RTCIV__RT0PSIFG: break; // RT0PSIFG case RTCIV__RT1PSIFG: break; // RT1PSIFG default: break; } }
Best Regards,
Divya Hari
Part Number:MSP432P401R
hi
refer to the datasheet of MSP432, the power consumption at active mode is 80uA/MHz, but the LOW FREQUENCY ACTIVE Mode's power consumption is 83uA @128KHz,
how come the power consumption of low frequency active mode higher than Active mode?
Part Number:MSP430FR2355
Tool/software: Code Composer Studio
how to start uart communication with msp430fr2355 to RealTerm?I am unfamiliar with this msp430fr2355 launchpad and RealTerm both.Please explain me everything from basic and how to make connection in the launchpad and how to interface realterm with launchpad as well as how to write data in the RealTerm so that we can transfer data between launchpad and RealTerm?
Part Number:MSP-EXP430G2
Hi,
I was recently starting to use the MSP-EXP430G2 LaunchPad with the MSP430G2231 chip on Mac OS X.
I could successfully install the drivers and the Energia software. I did also successfully flashed new programs to the MSP430G2231, not only with the Energia but also by using the mspdebug on the command line.
But then I disconnected the board from my Mac for a few minutes and when I tried to use it again, it seems to have stopped working. When I connect it to the computer, it shows up as: Texas Instruments TUSB3410 Boot Device, with ID 0451:3410 (not the expected 0451:f432).
I even tried to setup everything on a Windows 10 machine. I've downloaded and installed the drivers and the Energia, but even Windows only shows up TUSB3410 Boot Device in the device manager.
It seems to me that the ez430 debugger bricked somehow. But I can tell the MSP430G2231 is still working, since every time I connect the board to the power, it runs the last flashed program.
Any ideas on what could have happened? Would you suggest any workaround to keep programming the MSP chip?
Thanks!
Part Number:MSP430FR2433
Hi, I'm trying to read the DS1621 temperature sensor on I2C using MSP430FR2433.
Batch execution of reading lines of code causes the I2C bus to “hang” and the ACK confirmation bit is not generated !!!
bis.w #UCTXSTT, &UCB0CTLW0 ; I2C START+ADDRESS
mov.w #0x00AA, UCB0TXBUF ; Command DS1621 (Read Temperature)
bis.w #UCTXSTP, &UCB0CTLW0 ; I2C STOP
If I have a program in steps, then the I2C bus works!
There is a “partially” write cycle of the I2C bus in 2 stages
bis.w #UCTXSTT, &UCB0CTLW0 ; I2C START+ADDRESS
mov.w #0x00AA, UCB0TXBUF ; Command DS1621 (Read Temperature)
bis.w #UCTXSTP, &UCB0CTLW0 ; I2C STOP
or
bis.w #UCTXSTT, &UCB0CTLW0 ; I2C START+ADDRESS
mov.w #0x00AA, UCB0TXBUF ; Command DS1621 (Read Temperature)
bis.w #UCTXSTP, &UCB0CTLW0 ; I2C STOP
then after START + ADDRESS, ACK + TX_DATA appears in 50ms intervals regardless of baudrate.
Cycle recording of several bytes on the I2C bus is not possible with a partial step by step debugging in 2 stages.
bis.w #UCTXSTT, &UCB0CTLW0 ; START+ADDRESS
mov.w #0x00AA, UCB0TXBUF ; ACK+Command DS1621 (Read Temperature)
mov.w #0x00EE, UCB0TXBUF ; ACK+Command DS1621 (Initiates temperature conversion)
mov.w #0x0022, UCB0TXBUF ; ACK+Command DS1621 (Halts temperature conversion)
mov.w #0x00AA, UCB0TXBUF ; ACK+Command DS1621 (Read Temperature)
bis.w #UCTXSTP, &UCB0CTLW0 ; ACK+STOP
or
bis.w #UCTXSTT, &UCB0CTLW0 ; I2C START+ADDRESS
mov.w #0x00AA, UCB0TXBUF ; ACK+Command DS1621 (Read Temperature)
mov.w #0x00EE, UCB0TXBUF ; ACK+Command DS1621 (Initiates temperature conversion)
mov.w #0x0022, UCB0TXBUF ; ACK+Command DS1621 (Halts temperature conversion)
mov.w #0x00AA, UCB0TXBUF ; ACK+Command DS1621 (Read Temperature)
bis.w #UCTXSTP, &UCB0CTLW0 ; ACK+STOP
only ACK + 1 byte of data + is transmitted with the same interval of 50 ms appears on the NACK + STOP bus
If you pre-set the data in the register UCB0TXBUF and then in one command to set the bits START + STOP
mov.w #0x00AA, UCB0TXBUF ; Command DS1621 (Read Temperature)
bis.w #UCTXSTT+UCTXSTP, &UCB0CTLW0 ; I2C START+ADDRESS
START + ADRESS + ACK + STOP appear on the bus I2C.
Batch code execution causes only the first byte to be read!
bis.w #UCTXSTT, &UCB0CTLW0 ; I2C START+ADDRESS+RX_DATA
mov.w UCB0RXBUF, R7
bis.w #UCTXSTP, &UCB0CTLW0
mov.w UCB0RXBUF, R8 ; ACK+NACK+STOP
In the step-by-step execution of the
bis.w #UCTXSTT, & UCB0CTLW0
command in the debugger, it calls START + ADDRES + ACK + RX_DATA (16bit), while the UCB0RXBUF register (slau445h.pdf page 655) accepts only 8 low bits!
Read register UCB0RXBUF causes ACK + RX_DATA (8 bits) on the bus
mov.w UCB0RXBUF, R7
Read register command UCB0RXBUF when the #UCTXSTP bit is set causes ACK + NACK + STOP
bis.w #UCTXSTP, & UCB0CTLW0
mov.w UCB0RXBUF, R7 ; ACK + NACK + STOP
Running
bis.w # UCTXSTT + UCTXSTP, & UCB0CTLW0
causes a read cycle of 8 data bits START + ADDRESS + ACK + RX_DATA + NACK + STOP
How to read a few bytes of data?
IAR WorkBench ASM code:
;-------------------------------------------------------------------------------
; CPU: MSP430FR2433IRGER
;-------------------------------------------------------------------------------
; I2C adress:
; #090h - DS1621 (W)
; #091h - DS1621 (R)
; UCB0I2CSA = #048h
;-------------------------------------------------------------------------------
#include "msp430.h" ; #define controlled include file
RSEG CSTACK ; Define stack segment
RSEG CODE
;-------------------------------------------------------------------------------
RESET mov.w #SFE(CSTACK),SP ; Initialize stackpointer
StopWDT mov.w #WDTPW+WDTHOLD,&WDTCTL ; Stop watchdog timer
// Configure GPIO
BIS.b #BIT2+BIT3,P1SEL0 ; I2C pins
BIC.b #BIT2+BIT3,&P1DIR
bic.w #LOCKLPM5,PM5CTL0 ; Unlock I/O pins
// Configure USCI_B0 for I2C mode
bis.w #UCSWRST, &UCB0CTLW0
bis.w #UCMST, &UCB0CTLW0 ; I2C Master mode
bis.w #UCMODE_3, &UCB0CTLW0 ; eUSCI_B mode = I2C
mov.w #0x0100, UCB0BRW ; baudrate = SMCLK / 100
bic.w #UCSWRST, &UCB0CTLW0 ;
wait1 bit.w #UCBBUSY,&UCB0STATW ; wait until I2C module has finished all operations
JC wait1
// WIRITE I2C
mov.w #0x0048, UCB0I2CSA ; I2C slave address = DS1621
bis.w #UCTR, &UCB0CTLW0 ; I2C=TX
bis.w #UCTXSTT, &UCB0CTLW0 ; START+ADDRESS
mov.w #0x00AA, UCB0TXBUF ; ACK+Command DS1621 (Read Temperature)
mov.w #0x00EE, UCB0TXBUF ; ACK+Command DS1621 (Initiates temperature conversion)
// Pause
nop
// ----
mov.w #0x0022, UCB0TXBUF ; ACK+Command DS1621 (Halts temperature conversion)
mov.w #0x00AA, UCB0TXBUF ; ACK+Command DS1621 (Read Temperature)
bis.w #UCTXSTP, &UCB0CTLW0 ; ACK+STOP
// READ I2C
bic.w #UCTR, &UCB0CTLW0 ; I2C=RX
bis.w #UCTXSTT+UCTXSTP, &UCB0CTLW0 ;START+ADDRESS+RX_DATA
mov.w UCB0RXBUF, R7
bis.w #UCTXSTT, &UCB0CTLW0 ; I2C START+ADDRESS+RX_DATA
mov.w UCB0RXBUF, R7
bis.w #UCTXSTP, &UCB0CTLW0
mov.w UCB0RXBUF, R8 ; ACK+NACK+STOP
JMP $ ; jump to current location '$'
; (endless loop)
;-------------------------------------------------------------------------------
COMMON INTVEC ; Interrupt Vectors
;-------------------------------------------------------------------------------
ORG RESET_VECTOR ; Reset Vector
DW RESET
END
Part Number:MSP430F5529
Tool/software: Code Composer Studio
I just downloaded a brand new copy of CCS-V8, installed it and got the simple LED flashing example running on a '5529 launchpad.
Next I used the resource panel to install TI-RTOS. I started a project from the RTOS examples. I clean them and they build without errors but I'm having trouble getting them to run. In CCS, when I try to debug the project, the dialog shows the code being loaded but the debugger never never stops on the main of the program (and the LED never flashes). Adding breakpoints never stop the program. Loading the code externally using FET-Pro430 is no better (no led flashing). I suspect the issue is in the C library initialization code that runs before the code reaches main (since that is the only code that runs before main and it appears to be an execution issue and not a debug-connection-issue. Hence why I chose this forum and not the CCS forum.) Ideas?
Part Number:MSP430G2452
I need to drive P2.6 (XIN) with an external (12 or 16 MHz) crystal-controlled digital source, and have this source used to drive MCLK.
I am successfully able to use the same signal/pin to drive SMCLK (I can verify the clock signal from P1.4 when configured as SMCLK output), however, I am not able to use the signal to drive MCLK. MCLK appears instead to be running at the default DCO rate ~ 1 MHz.
This (having MCLK controlled by an external high-frequency digital source) is a project requirement.
The MSP430 assembly language code fragment I am using at this point to configure clocks is as follows, with explanation of my selections (all other clock-related control registers are at power-up default):
bis.b #LFXT1S_0+XCAP_0, &BCSCTL3 ; LFXT1S = External, load caps off (XTS=0)
bis.b #SELS+DIVS_0+SELM_3+DIVM_0, &BCSCTL2 ; MCLK=SMCLK=External/1
I also tried this to turn off DCO, to no avail:
bis #40h, SP ; SCG0 = 0 - turn off DCO
BCSCTL2: SELM_3 - Do not source MCLK from DCOCLK
BCSCTL2: DIVM_0 - Divide by 1 for MCLK
BCSCTL2: SELS - Do not source SMCLK from DCOCLK
BCSCTL2: DIVS_0 - Divide by 1 for SMCLK
BCSCTL3: LFXT1S_0 - XTS=0, Digital External Clock Source
Thank you for any assistance.
Part Number:MSP430FR5994
I am trying to setup the sensors boosterpack demo to showcase the device, but I am unable to get the GUI working showing the data reads. I was able to run the out of the box demo with the GUI for that, but when I run the GUI source code for the boosterpack in CCS and then try to connect the MSP430 in the Boosterpack GUI, it continually says waiting for data at the bottom.
Part Number:MSP430FR2311
Tool/software: Code Composer Studio
I think there is an error in driverlib for adc.h The channel mappings don't match up with Table 6-16 in www.ti.com/.../msp430fr2311.pdf
I'm trying to use A1 (P1.1) as analog input and so I'm trying to figure out which to use. I'm assuming if the mapping is incorrect I should use ADC_INPUT_VEREF_P since it maps to ADCINCH_1
//***************************************************************************** // // The following are values that can be passed to the inputSourceSelect // parameter for functions: ADC_configureMemory(). // //***************************************************************************** #define ADC_INPUT_VEREF_N (ADCINCH_0) #define ADC_INPUT_VEREF_P (ADCINCH_1) #define ADC_INPUT_A2 (ADCINCH_2) #define ADC_INPUT_A3 (ADCINCH_3) #define ADC_INPUT_A4 (ADCINCH_4) #define ADC_INPUT_A5 (ADCINCH_5) #define ADC_INPUT_A6 (ADCINCH_6) #define ADC_INPUT_A7 (ADCINCH_7) #define ADC_INPUT_A8 (ADCINCH_8) #define ADC_INPUT_A9 (ADCINCH_9) #define ADC_INPUT_TEMPSENSOR (ADCINCH_12) #define ADC_INPUT_REFVOLTAGE (ADCINCH_13) #define ADC_INPUT_DVSS (ADCINCH_14) #define ADC_INPUT_DVCC (ADCINCH_15) //*****************************************************************************
Part Number:MSP430FR5947
I am using MSP430FR5947 controller (38 pin, DA Package). As both MSP430FR5947 and MSP430FR5949 are pin to pin compatible, the only difference is FRAM size and location.
1. In MSP430FR5949 FRAM starts from 0x4400 (size 63 kB), in MSP430FR5947 FRAM starts from 0x8000 (size 32 kB)
2. RAM Size is 1 kB for MSP430FR5947, 2kB for MSP430FR5949.
Can I use MSP430FR5947 linker command file (i.e., memory mapping) for MSP430FR5949, as FRAM start address 0x8000 is in between start and end address of FRAM of MSP430FR5949 (If code size is not an issue), 1kB data memory (RAM) is suffiecient for me.
Part Number:MSP430F2274
How to get the demo source code?