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

CCS/MSP-EXP430FR5994: Software execution stop after a random time period and UART communication

$
0
0

Part Number:MSP-EXP430FR5994

Tool/software: Code Composer Studio

I am working with the MSP430FR5994 devkit hardware. I am experiencing the following problem: during the UART communication, the software execution stop after a random time period.

My while structure:

while(1)
{
    LED toggle on P1.1 pin  (for oscilloscope tracking)

    if (ISRflag=1)
    {
        Read I2C sensor data
        Data conversion
        Send data over UART
    }
}

I query the sensor at a 10ms time interval. When UART data transfer is switched OFF, the code running without any problem.

When the UART data transfer switched ON, the code execution terminated after a random period of time. This random time period varies, it sometimes happen after 1 minute, sometimes after 15-20 minutes, etc. During the code execution, I measure square signal at the P1.1 pin. When the code execution terminated randomly, the status of P1.1 shows continues L or H level.

My UART init code:

void uartInit()
{
    P2SEL0 &= ~(BIT0 | BIT1);
    P2SEL1 |= BIT0 | BIT1;                  // USCI_A0 UART operation

    // Configure USCI_A0 for UART mode
    UCA0CTLW0 = UCSWRST;                    // Put eUSCI in reset
    UCA0CTLW0 |= UCSSEL__SMCLK;             // CLK = SMCLK 8MHz
    UCA0BRW = 4;                            // 8000000/16/115200bps
    UCA0MCTLW |= UCOS16 | UCBRF_5 | 0x5500; // UCBRSx value = 0x55 (See UG)
    UCA0CTLW0 &= ~UCSWRST;                  // Initialize eUSCI
    UCA0IE |= UCRXIE;                       // Enable USCI_A0 RX interrupt
test.newStringReceived = FALSE; }

UART interrupt routine:

#pragma vector=EUSCI_A0_VECTOR
__interrupt void USCI_A0_ISR(void)
{
//	int receiveByte = UCA0RXBUF;
//	UCA0TXBUF = receiveByte;

    switch(__even_in_range(UCA0IV, USCI_UART_UCTXCPTIFG))
    {
        case USCI_NONE:
        	break;

        case USCI_UART_UCRXIFG:
            RTS_CLEAR;
            char data = UCA0RXBUF;  //RXBUF0;

            //#define ECHO_ON
        #ifdef ECHO_ON
            while (!(IFG1 & UTXIFG0));                // USART0 TX buffer ready?
            TXBUF0 = data;                          // RXBUF0 to TXBUF0
        #endif

            uartReceive(data);
            if(test.newStringReceived == TRUE){
        //        _bic_SR_register_on_exit(LPM4_bits); /* Exit Low Power Mode 4 */
            }
            RTS_SET;
            break;

        case USCI_UART_UCTXIFG:
        	break;

        case USCI_UART_UCSTTIFG:
        	break;

        case USCI_UART_UCTXCPTIFG:
        	break;

        default:
        	break;
    }

    __bic_SR_register_on_exit(LPM0_bits);   // Exit active CPU
}

Transmission routine:

void sendBytes(int len){
	
   unsigned int i;

	for (i = 0; i < len; ++i)
    {
	   // wait until UART ready
	   while (!(UCA0IFG & UCTXIFG));             // USCI_A0 TX buffer ready?
	   UCA0TXBUF = test.txString[i];
    }
}

String definition in uart_driver.h file:

typedef struct {
	unsigned char newStringReceived;
	char          txString[MAX_STR_LENGTH];
	char          rxString[MAX_STR_LENGTH];
}s_test;

extern s_test test;

From main.c:

while(1)
	{
            LED2_TOGGLE();

		if (readDataFlag)
		{
			readDataFlag = 0;
			AFE44xx_SPO2_Data_buf[0] = AFE4404_Reg_Read(42);  //read LED2 Data
			AFE44xx_SPO2_Data_buf[1] = AFE4404_Reg_Read(43);  //read LED3 data
			AFE44xx_SPO2_Data_buf[2] = AFE4404_Reg_Read(44);  //read LED1 Data
			AFE44xx_SPO2_Data_buf[3] = AFE4404_Reg_Read(45);  //read Ambient Data
			AFE44xx_SPO2_Data_buf[4] = AFE4404_Reg_Read(46);  //read LED2 - LED3 Data
			AFE44xx_SPO2_Data_buf[5] = AFE4404_Reg_Read(47);  //read LED1 - Ambient Data
			sendDataFlag = 1;
		}

		if (sendDataFlag)
		{
			statHRMAlgo (AFE44xx_SPO2_Data_buf[5]);
			// Overwrite LED2-AMB2 with Heart rate
			AFE44xx_SPO2_Data_buf[4] = HeartRate;

			sendDataFlag = 0;

			test.txString[0] = (unsigned char)(AFE44xx_SPO2_Data_buf[0] & 0x000000FF);  // LED2 Data
			test.txString[1] = (unsigned char)((AFE44xx_SPO2_Data_buf[0] & 0x0000FF00) >> 8);
			test.txString[2] = (unsigned char)((AFE44xx_SPO2_Data_buf[0] & 0x00FF0000) >> 16);

			test.txString[3] = (unsigned char)(AFE44xx_SPO2_Data_buf[1] & 0x000000FF);  // LED3 data
			test.txString[4] = (unsigned char)((AFE44xx_SPO2_Data_buf[1] & 0x0000FF00) >> 8);
			test.txString[5] = (unsigned char)((AFE44xx_SPO2_Data_buf[1] & 0x00FF0000) >> 16);

			test.txString[6] = (unsigned char)(AFE44xx_SPO2_Data_buf[2] & 0x000000FF);  // LED1 Data
			test.txString[7] = (unsigned char)((AFE44xx_SPO2_Data_buf[2] & 0x0000FF00) >> 8);
			test.txString[8] = (unsigned char)((AFE44xx_SPO2_Data_buf[2] & 0x00FF0000) >> 16);

			test.txString[9] = (unsigned char)(AFE44xx_SPO2_Data_buf[3] & 0x000000FF);  // Ambient Data
			test.txString[10] = (unsigned char)((AFE44xx_SPO2_Data_buf[3] & 0x0000FF00) >> 8);
			test.txString[11] = (unsigned char)((AFE44xx_SPO2_Data_buf[3] & 0x00FF0000) >> 16);


			//txString[12] = (unsigned char) EOT;
			test.txString[13] = (unsigned char) HeartRate;
			test.txString[14] = (unsigned char) LF;
			test.txString[25] = (unsigned char) CR;

			printf(test.txString);
			sendBytes(16); //Send UART data string  115200bps & 22byte = 1.90972222ms
		}


	}

/*******************************************************************************
 * Port 3 interrupt service routine
 ******************************************************************************/

#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=PORT3_VECTOR
__interrupt void port3_isr_handler(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(PORT3_VECTOR))) port3_isr_handler (void)
#else
#error Compiler not supported!
#endif
{
    switch(__even_in_range(P3IV, P3IV__P3IFG7))
    {
        case P3IV__NONE:
        	break;          // Vector  0:  No interrupt
        case P3IV__P3IFG0:
        	break;          // Vector  2:  P1.0 interrupt flag
        case P3IV__P3IFG1:
            break;			// Vector  4:  P1.1 interrupt flag
        case P3IV__P3IFG2:
        	break;          // Vector  6:  P1.2 interrupt flag
        case P3IV__P3IFG3:
        	break;          // Vector  8:  P1.3 interrupt flag
        case P3IV__P3IFG4:
        	break;          // Vector  10:  P1.4 interrupt flag
        case P3IV__P3IFG5:
        	break;          // Vector  12:  P1.5 interrupt flag
        case P3IV__P3IFG6:
        	LED1_TOGGLE();  // Diag
        	readDataFlag = 1;  // Set Flag to read AFE44x0 ADC REG data
        	break;          // Vector  14:  P1.6 interrupt flag
        case P3IV__P3IFG7:
        	break;          // Vector  16:  P1.7 interrupt flag
        default:
        	break;
    }
}


MSP432P401R: MSP432 Rev. D and C I2C

$
0
0

Part Number:MSP432P401R

Hi,

In my setup I have 2 MSP432 that communicate through I2C. I did the development using 2 LaunchPad MSP432 (Rev 2.1) development boards (MSP432 Rev. C).

Whit these dev boards, everything works perfect. Now, I have developed my own board which integrates a MSP432 Rev. D.

When I try to communicate my board (MSP432 Rev. D) with the eval board (MSP432 Rev. C) things don't go as expected. I'm using driverlib v3_21_00_05 (last version).

I had similar problems before when working with LaunchPad 1 (MSP432 Rev. B). In that case, it was because driverlib version was not compatible with MSP432 Rev. B.

My question: Is there any reported issue with driverlib when working with MSP432 Rev. D ? Does the MSP432 Rev. D have some issues with I2C ports ?


Regards,

Oscar

MSP432P401M: About Current Consumption in MSP432P4?

$
0
0

Part Number:MSP432P401M

MSP432P4 only enable 32Khz, the current consumption is 0.9uA.
But when enable Timer A and source by 32KHz, the current consumption raise to 730uA, I think this is not normal, but can not find the reason? Would you please give me hand?

Many thanks

MSP430F5529: BSL over BLE

$
0
0

Part Number:MSP430F5529

MSP430 experts,

Has anyone implemented successfully a BSL solution for a device like MSP430F5529 (or similar) over a bluetooth link with CC2640 (or CC2640R2F)?  I'm expecting the CC2640 to act as a serial "pass-through" running Bluetooth Serial Port Profile (SPP), and the BSL commands to come from the Android or iPhone App.

I know we've done something similar with the MSP432 and CC2640 as part of the SimpleLink software package. 

I'm interested in knowing if there are any known challenges our customer will run into with implementing this for the F552x.

Thanks,

Darren

MSP-TS430PW14: SBW communication not working

$
0
0

Part Number:MSP-TS430PW14

Hello Team,

I am working with a customer who is developing with the MSP-TS430PW14 for SBW communication. 

Details:

The problem that I’m having is connecting to an MSP430 using Spy Bi Wire. I am able to connect to the part using JTAG, but I will need the use the SBW for this project.

 

They have an MSP-FET, and a MSP-TS430PW14. The MSP-TS430PW14 came with sample MSP430F2013. Their intended target will be a MSP430F2002.

 

They are running CCS v7.2.0.00013.

 

The CCS did upgrade the MSP-FET firmware when they first connected it.

 

Out of the box the MSP-TS430PW14 came configured for SBW. During debug, they got the following message.

Error connecting to target : Unknown Device


It was tried with both the sample MSP430F2013, and a MSP4302002 with the same result.  Then reconfigured the MSP-TS430PW14 for JTAG, and they were able to successfully connect and debug. 

This has been tried on 2 different Windows 10 machines with the same result.

The cables came in the box with the unit and even replacing them with alternatives did not work

  • micro USB cable w/ ferrite
  • 6” 14 pin ribbon cable (They don’t have a shorter cable) 

The MSP-TS430PW14 came configured for SBW (J7-J12 all set 1-2). The Vcc jumper (J5) is set to int. 

Originally a CCS ‘Blink the LED’ project targeting the MSP430F2013 was attempted. With the ‘out of the box’ SBW configuration, they were not able to connect to the target. By simply changing to JTAG (changing J7-J12 to 2-3), it was able to connect and run, and debug. 

Then created a ‘fresh’ CCS ‘Blink the LED’ Project targeting an MSP430F2002, replaced the actual MSP430F2013 with an MSP430F2002, and repeated the debug attempt with the same results as above.

 After more discussions with the customer last week, they found that hanging a scope probe on the reset pin of the part (pin 10), caused the part was detected in SBW, but the subsequent “trouble writing memory block” error occurred. : Trouble writing memory block at 0xfc00 on page 0 of length 0x4c 

They have repeated these tests by trying to run on a completely different computer with an independently installed CCS and freshly created project. So, that this is a completely different workspace. 

It has been verified (with the scope) that the 3.3V is stable during the SBW debug attempt. 

To summarize:

While using all the above TI provided parts, devices, cables, etc…, they are able to install CCS, use CCS to create an example ‘Blink the LED’ project, then successfully program the part and debug while using 4 wire JTAG only

2 wire SBW does not work

Hanging a scope probe on the target reset line facilitates connection to the part while in SBW configuration, but does not allow programming of the part.

Is there any other suggestions that the customer can try to get the SBW connection up and running ? 

I appreciate your time and support towards this case.

Sincerely,

Kishen

 

Compiler/MSP430F5659: RTC Battery backup

$
0
0

Part Number:MSP430F5659

Tool/software: TI C/C++ Compiler

Hi support,

I run MSP430Ware_3_80_01_01\driverlib\examples\MSP430F5xx_6xx\battbak\IAR\battbak_ex1_calendermodeLPM3  project on IAR to test battery backup function.

question 1:  how to test RTC is backpedaled.

question 2: I run the code to 27 minutes and 28 minutes,  I restart the code it still run to 27 minutes and 28 minutes.  the backup does not work.,

I check the battery connect to  MSP430F5659 pin 87, it is 3.267V 

could you help and point out what I did wrong.?

MSP432P401R: Best Practices hitting the 1 msps rate over 3 channels using DMA

$
0
0

Part Number:MSP432P401R

My Customer is having trouble hitting the 1 msps (actually needs 600khz) rate over 3 channels using the DMA.  

I’m working to get the ADC14 running at 200 kSPS per channel, alternating between 3 channels for a total of 600 kSPS. I’m running at 48 MHz, have the ADC samples being triggered by TIMER_A, cycling between 3 analog channels. I’m close to 600 kSPS rate using just using ADC interrupts & no DMA, but am missing samples, as expected. I started this way (without DMA) to get my input lines, clocks, & ADC doing what I want. Now, I’m trying to fold DMA into the mix.

I need DMA to handle 2 transfer scenarios:  (1) Directly into the SPI TX, and (2) Directly into a local RAM array (for pre-processing steps before SPI transfer).

I have scoured the Project|Examples|Resource Explorer, and don’t see anything this complex. Are there other sources of examples?

Apparently, there’s only 1 DMA channel that supports being triggered by the ADC (DMA Channel 7). If I’m sampling 3 channels (A0-A2), the DMA gets triggered after all 3 are scanned, so 3 transfers occur and the DMA interrupt goes off. Then, in the DMA interrupt, I have to update the destination address to move 3 entries down. This takes too long, so am missing samples.

What speed are you running the processor?     [48 MHz]

What resolution are you running the ADC?       [14-Bit]

What is your ADC14CLK?  [24 MHz]

What is your ADDC 14PDIV? [I don’t know what this is; Using ADC_DIVIDER_2) 

What clock Source are you using?  [MCLK]

SLAA707.pdf appeared relevant, but upon review was not useful to the customer.

Code available on request for internal review.

Thanks! 

Blake

 

SIMPLELINK-MSP432-SDK: f_open using FatFs library returns FR_DISK_ERR in executed without inserting break points

$
0
0

Part Number:SIMPLELINK-MSP432-SDK

Hi Team,

I have written a sample code where in I am opening a file in the write mode and always open mode in the SD card and writing data into that file continuously based on key press event.

The issue is as follows:

If break point is inserted at f_close function and the example is executed, the file is correctly written into the SD card for every key press event.

So the sequence is that key pressed -> f_open  is called and file is written into the SD card file -> After complete file is written f_close is called -> again a new file is created and closed.

So next time whenever the key is pressed, the data is straight away written into the new file created and above sequence is executed.

Now, if I don't place the break point at the f_close statement and executed the firmware after the first file written whenever next time the firmware goes to open the second file to write the data into it the f_open function returns "FR_DISK_ERROR"

This is repeated every time. So after the first file successfully written no other file is written.

But if the break point is inserted at f_close then the f_open does not return FR_DISK_ERROR.

I even tried to insert delay between f_close and f_open functions but even that did not solve the issue.(Please visit the site to view this file)

I am attaching the code for your reference to look into.

Please let me know what is wrong with it.

Thank you in advance.

Vikram


RTOS/SIMPLELINK-MSP432-SDK: No function similar to UARTCharAvail present in TIVA driver library for MSP432

$
0
0

Part Number:SIMPLELINK-MSP432-SDK

Tool/software:TI-RTOS

Hi Team,

My earlier project was made using TIVA board. However, now we have moved to MSP432 launchpad and we are using the Simplelink SDK version.

I am using the RTOS concept and I am trying to find if there is any function similar to "UARTCharsAvail(uint32_tBase)" that is available in the TIVA driver library to check if any characters are been there in the receive FIFO for continuous UART operation?

Please let me know if not I have to find a work around.

Thank you in advance.

Vikram

MSP430FR5994: easy way to track down un handled interrupt?

$
0
0

Part Number:MSP430FR5994

Is there an easy way to catch an unhandled interrupt with the debugger.  I can't see to find it manually and I thought there was a debug setting you could use to make this easier?

Thank you

MSP430F67491: Trying to understand the clocking structure for the SD_24 data converter and DC spec the converter can achieve

$
0
0

Part Number:MSP430F67491

Hi Support team

I am a TI FAE (analog) and am working on a design where i need a smart  isolated ADC. I need to read 4 channels simultaneously, and need accurate DC specifications. So I am having trouble understand the clocking structure for FS, second, I am trying to see what type of performance I can get out of the data converters with a sampling rate of 1KHz, and third I need the DC performance, vos, drift, INL, DNL, 

Can you help me out with this?

Thanks

Jeff Coletti

MSP430F5529: Any tricks for 16bit SPI framing + DMA

$
0
0

Part Number:MSP430F5529

Hi,

We need to drive a 16bit SPI DAC from MSP430F5529. The key for the DAC is that the nCS line needs to be de-aserted every 2 bytes for the DAC to update.

Problem with this design is we need to make use of a DMA SPI transfer for timing of data to the DAC, and as MSP430F5529 only supports 8 bit transfers, we seem to be stuck.

We have tried using software methods to support the DAC framing requirements, but the timing requirements for the output from the DAC make this difficult to do successfully.

Does anyone have a solution or novel hack that might work in this instance?  

Thanks.

Stomp!

MSP430G2402: Strange problem with RESET vector location in memory

$
0
0

Part Number:MSP430G2402

Goodmorning TI Community,

Today I write to You because of a strange problem with some elecrtonic board on which there is the MPS430G2402 processor.

After some work cycles the processor stops working well and gets lost.

The origin of this particular behaviour is that unexpectedly the location of the RESET vector reprograms itself with an undefined address

so that the processor doesn't know anymore where is the start point of the program.

The firmware (written in assembly) has been tried and tested for many years and every machine works very well with it.

This is the first time that something like this happens and I don't know why.

Which are the possible reasons?

I also have another doubt/question: the flash of MSP430 micro-processor is protected by accidental writing, isn't it?

So, how is it possible that the reset vector's original address gets lost and auto re-programmed with an undefined value?

You need to know that in this application I only access to the Info Memory, which contains the A to D segments, and I don't write on the Flash Memory.

I hope someone could help me to resolve this strange problem.

Thank you for the attention.

Kind Regards,

Luigi Quaglia.

MSP430F67751A: XT1bypass is not set, but used oscillator as input

$
0
0

Part Number:MSP430F67751A

Hi,

I have not set XT1BYPASS. But I have used a square wave oscillator as input to XIN

The Micro controller is working without any issues.

Is this wrong

regards

subbu

Linux/MSP430FR2533: Programming MSP430FR2533 in Linux via SBW

$
0
0

Part Number:MSP430FR2533

Tool/software: Linux

Hello e2e,

our customer need implement SBW protocol in Linux to programming MSP430FR2533, could you pls help to share the related resource to us?

thanks in advance.

LEON


MSP430FR5969: What happened to tidm-hrttransmitter reference design?

$
0
0

Part Number:MSP430FR5969

Hi,

There are a lot of references to a HART and 4-20mA transmitter reference design based on MSP4305969 MCU (TIDM-HRTTRANSMITTER)  scattered all over TI webspere, but all the links and search attempts end up with "page not found...". Does anybody know, what happened to that refernce design?

Piotr

MSP430F5659: UCS Questions regarding clocking

$
0
0

Part Number:MSP430F5659

Hi there!

I'm using MSP430F5659 which has dedicated XIN and XOUT pins. I have read the entire UCS chapter in the Family User's Guide but yet was not able to understand everything.
Assume that we are not configuring any UCS registers at all in our code, and we have applied power to the mcu:

  1. ACLK. At startup it uses XT1CLK as a source but because of XT1 is not yet stable immediately switches to REFOCLK, while SELA still equals to zero (pointing to XT1). Will it automatically switches back to XT1CLK when XT1 stabilizes? If not, how can we switch it back to XT1?
  2. Is the same thing happening with FLLREFCLK?
  3. I'm planning to use the same 32768-Hz crystal that is used in MSP430F5529 launchpad. Launchpad has external 12 pF capacitors added, but all the examples also setting XCAP_3 which per datasheet set Ceff to 12pF. Two external 12pF results in 6pF + 12pF from Ceff = 18pF which is way above the 12.5 needed for the crystal. What's wrong with my calculations?

MSP430F6 sigma-delta evaluation

$
0
0

I'm interested in using the integrated MSP430 24-bit sigma-delta ADC (the MSP430F67xx family).
However, I could find no LaunchPad nor experimenter's board for this family, only for the MSP430F5xxx family.

Is there any evaluation board I could buy for the family I'm interested in?
Or at least some reference design to roll my own evaluation board, with suggestions to get the most precision out of the 24-bit sigma-delta ADC (including PCB routing considerations)?

MSP432P401R: Performance issues with FIR filtering

$
0
0

Part Number:MSP432P401R

Hello,

I'm developing a DSP application for real-time audio processing, and have run into an issue with FIR filtering performance. My setup works by sampling ADC14 based on a timer, filtering, then writing the output to a DAC. The application works perfectly when no filtering is done (essentially sampling then immediately playing back the sample), but when I add the filtering function, the system seemingly cannot keep up.

Could someone take a look and see if I'm doing something wrong, or point me towards some example code? This is being developed as a demonstration, so I'd rather implement it manually rather than using a built-in DSP library.

// Fixed-point FIR service routine
int16_t FIR(const uint8_t M, const int16_t* fir, int16_t* buffer,
		uint8_t* buffer_index, const int16_t x) {

	uint8_t i; //fir ceofficient index
	int8_t p; //buffer index corresponding to fir ceofficient
	int32_t acc; //return value

	*buffer_index = *buffer_index % M;
	buffer[*buffer_index] = x;	//wrap and update buffer

	for(acc=0, p=*buffer_index, i=0; i<M; i++){
		if(p<0) { p += M; } //wrap buffer index
		acc += ((int32_t)fir[i])*((int32_t)buffer[p]); //MAC
		p--; //decrement buffer index
	}

	// saturate the result
	if ( acc > 0x3fffffff ) {
			acc = 0x3fffffff;
	} else if ( acc < -0x40000000 ) {
			acc = -0x40000000;
	}

	(*buffer_index)++; //increment oldest cell index of buffer
	return (int16_t)(acc >> 16); //truncate result
}

// Timer and ADC routines
void TA0_N_IRQHandler(void) {
	if(TIMER_A0->CCTL[1] & CCIFG) {
		DAC8311_writeOut(GLOBAL_s14_to_u14(sample)); // update later to be the result DWT

		/* CCR[0] needs to be updated for ADC trigger */
		TIMER_A0->CCR[0] += GLOBAL_period;
		TIMER_A0->CCR[1] += GLOBAL_period;

		TIMER_A0->CCTL[1] &= ~CCIFG;
	}
}

void ADC14_IRQHandler(void) { sample = GLOBAL_u14_to_s14(ADC14->MEM[0]); }

// System clock configuration
void TIMER_clkInit(void)
{
    CS->KEY = CS_KEY_VAL; //Unlock CS registers
    
    CS->CTL0 = 
    	CS_CTL0_DCOEN |
        CS_CTL0_DCORSEL_5; //Choose 48 MHz MHz clock speed

    CS->CTL1 =
    	CS_CTL1_SELS_3 |
        CS_CTL1_SELM_3  ; //Use DCOCLK as source for MCLK, SMCLK + HSMCLK
                    
    CS->KEY = 0;                      //Re-lock CS registers
}

I've included the case where I do not do any filtering, but failure occurs when I add an FIR service routine to the timer interrupt. It even fails when I return the filter output to a value that is not the written sample (diverting the filter output to a dummy value, and writing the original sample to the DAC anyway).

Thanks,

Thomas

MSP432P401R: MSP432P401R Launchpad and TMP100 temperature sensor issue

$
0
0

Part Number:MSP432P401R

I am unable to get temperature readings from the TMP100. I am using EUSCI B2. In tracing my code ( using as much of the Driverlin APIs as possible).

ADD0 AND ADD1 lines are grounded on the chip 

I have included a screen shot of the SCL and SDA waveforms when  i call: TMP100SendData( data_buffer, SlaveAddress);

in the TMP100Init(...)  fucntion the function and execute the line:

MAP_I2C_masterSendMultiByteStart(EUSCI_B2_BASE, buffer[i]); // Send start, address and 1st byte

It appears the code is writing the correct address ( i.e. 0x48, but i see no 'ACK'  before sending 0x01 )

SCL - Top plot

SDA - Bottom plot

CODE:

#define TMP100_SLAVE_ADDRESS0   0x48

#define TMP100_RES_12BITS              0x60 // Typically 320ms conversion time

#define NON_SHUTDOWN_MODE       0x00 // Continuous conversion

After setting up the EUSCI_B2 as a Master, I run the following initailization function:

    TMP100Init(TMP100_SLAVE_ADDRESS0, TMP100_RES_12BITS | NON_SHUTDOWN_MODE ); // Equiv to TMP100Init( 0x48, TMP100_RES_12BITS | NON_SHUTDOWN_MODE )

void TMP100Init(uint_fast16_t SlaveAddress, uint8_t Config_Reg_Value )
{

uint8_t data_buffer[3];

data_buffer[0] = TMP100_CONFIG_REGISTER;  //  0x01
data_buffer[1] = Config_Reg_Value ; // 0x01
data_buffer[2] = 0; // Buffer termination for 'TMP100SendData routine

TMP100SendData( data_buffer, SlaveAddress);

// Reset to reading Temperature

data_buffer[0] = TMP100_TEMP_REGISTER;
data_buffer[1] = 0; // Buffer termination for 'TMP100SendData routine

TMP100SendData( data_buffer, SlaveAddress);

}

void TMP100SendData( uint8_t *buffer, uint_fast16_t SlaveAddress)
{


unsigned int i = 0;

// Specify slave address
MAP_I2C_setSlaveAddress(EUSCI_B2_BASE, SlaveAddress);

// Set Master to transmit mode
MAP_I2C_setMode(EUSCI_B2_BASE, EUSCI_B_I2C_TRANSMIT_MODE);

MAP_I2C_masterSendMultiByteStart(EUSCI_B2_BASE, buffer[i]); // Send start, address and 1st byte

i++;
while( buffer[i] != 0)
{
MAP_I2C_masterSendMultiByteNext(EUSCI_B2_BASE, buffer[i]);
i++;
}
MAP_I2C_masterSendMultiByteStop(EUSCI_B2_BASE); // End Transmission

}

Viewing all 22007 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>