Quantcast
Channel: Forums - Recent Threads
Viewing all 262198 articles
Browse latest View live

CCS/MSP-EXP430F5529LP: UART clocked via SMCLK problem

$
0
0

Part Number:MSP-EXP430F5529LP

Tool/software: Code Composer Studio

Hello,

I'm using the myUART_5529 example which can be found here: http://processors.wiki.ti.com/index.php/MSP_UART

It works very nice until I try to change the system clocks. The default speed is set to 8MHz from SMCLK. The clock configuration is as below:

#include "initclocks.h"

// ----------------------------------------------------------------------------
// myClocks.c  (for lab_04a_clock project)  ('F5529 Launchpad)
//
// This routine sets ACLK to run from REFO, then configures MCLK and SMCLK to
// run from the and high-freq internal clock source (DCO).
//
// Oscillators:
//    DCO    =   8MHz  (default is ~1MHz) Internal high-frequency oscillator
//    REFO   =  32KHz                     Internal 32KHz reference oscillator
//    MODOSC =   5MHz                     Internal 5MHz oscillator
//    VLO    = ~10KHz                     Internal very low power, low frequency oscillator
//    XT1    =  --KHz  (not configured)   External crystal input
//    XT2    =  --MHz  (not configured)   External crystal input
//
// Reference Clock:
//    FLL    = REFO   =  32KHz            Internal reference clock; used for calibrating DCO at runtime

// Internal Clocks:
//    ACLK  =  REFO   =  32KHz
//    SMCLK =  DCO    =   8MHz
//    MCLK  =  DCO    =   8MHz
//    MODCLK = MODOSC =   5MHz  (default)
// ----------------------------------------------------------------------------

//***** Defines ***************************************************************
//VLO - ~10 KHz
//REFO - 32768 Hz
//XT1 - LF:<50 KHz
//XT1 - HF: 4 MHz max
//XT2 - 4-40 MHz
//DCO - 100 KHz to CPU max
//MODOSC - 5 MHz or 5 MHz/128 used by Flash or ADC

#define LF_CRYSTAL_FREQUENCY_IN_HZ     32768                                    // 32KHz
#define HF_CRYSTAL_FREQUENCY_IN_HZ     8000000                                  // 40MHz

#define MCLK_DESIRED_FREQUENCY_IN_KHZ  8000                                     // 25MHz
#define MCLK_FLLREF_RATIO              MCLK_DESIRED_FREQUENCY_IN_KHZ / ( UCS_REFOCLK_FREQUENCY / 1024 )    // Ratio = 250

#define XT_TIMEOUT                     50000

//***** Global Variables ******************************************************
uint32_t myACLK  = 0;
uint32_t mySMCLK = 0;
uint32_t myMCLK  = 0;
uint8_t  returnValue = 0;
bool     bReturn     = STATUS_FAIL;


//***** initClocks ************************************************************
inline void initClocks(void)
{

    // Connect pins to clock crystals
    GPIO_setAsPeripheralModuleFunctionInputPin(
            GPIO_PORT_P5,
            GPIO_PIN5 +                                  // XOUT on P5.5
            GPIO_PIN4 +                                  // XIN  on P5.4
            GPIO_PIN3 +                                  // XT2OUT on P5.3
            GPIO_PIN2                                    // XT2IN  on P5.2
    );

    //    // Output the ACLK and MCLK signals to their respective pins - which allows you to
    //    // watch them with a logic analyzer (ACLK on P1.0, SMCLK on P2.2, MCLK on P7.7)
    //    GPIO_setAsPeripheralModuleFunctionOutputPin(
    //            GPIO_PORT_P1,
    //            GPIO_PIN0                                    // ACLK on P1.0   (Shared with LED1 on jumper JP8)
    //    );
    //    GPIO_setAsPeripheralModuleFunctionOutputPin(
    //            GPIO_PORT_P2,
    //            GPIO_PIN2                                    // SMCLK on P2.2  (Boosterpack - Right side (J5) pin 2)
    //    );

    //**************************************************************************
    // Configure core voltage level
    //**************************************************************************
    // Set core voltage level to handle 25MHz clock rate
    PMM_setVCore( PMM_CORE_LEVEL_3 );


    //**************************************************************************
    // Configure Oscillators
    //**************************************************************************
    // Set the XT1/XT2 crystal frequencies used on the LaunchPad, and connected
    // to the clock pins, so that driverlib knows how fast they are (these are
    // needed for the DriverLib clock 'get' and crystal start functions)
    UCS_setExternalClockSource(
            LF_CRYSTAL_FREQUENCY_IN_HZ,                                         // XT1CLK input
            HF_CRYSTAL_FREQUENCY_IN_HZ                                          // XT2CLK input
    );

    // Initialize the XT1 crystal oscillator (using a timeout in case there is a problem with the crystal)
    // - This requires P5.4 and P5.5 pins to be connected (and configured) as clock input pins.
    // - Another alternative is to use the non-timeout function which "hangs" if XT1 isn't configured;
    //    UCS_turnOnXT1( CS_XT1_DRIVE_0, UCS_XCAP_3 );   (in fact, we used the non-timeout function to setup XT2)
    // - The "WithTimeout" function used here will always exit, even if XT1 fails to initialize.
    //   You must check to make sure XT1 was initialized properly... in a real application, you would
    //   usually replace the while(1) with a more useful error handling function.
    bReturn = UCS_turnOnLFXT1WithTimeout(
            UCS_XT1_DRIVE_0,
            UCS_XCAP_3,
            XT_TIMEOUT
    );

    if ( bReturn == STATUS_FAIL )
    {
        while( 1 );
    }

    // Initializes the XT2 crystal oscillator with no timeout.
    // In case of failure, code hangs here.
    // For time-out instead of code hang use UCS_turnOnXT2WithTimeout().
    UCS_turnOnXT2(UCS_XT2_DRIVE_24MHZ_32MHZ);

    //    This is an example of turning on XT2 with the the timeout option.
    //    bReturn = UCS_turnOnXT2WithTimeout(
    //                  UCS XT2 DRIVE 4MHZ 8MHZ,
    //                  XT2_TIMEOUT
    //              );
    //
    //    if ( bReturn == STATUS_FAIL )
    //    {
    //        while( 1 );
    //    }

    // Verify if the default clock settings are as expected
    myACLK  = UCS_getACLK();
    mySMCLK = UCS_getSMCLK();
    myMCLK  = UCS_getMCLK();


    //**************************************************************************
    // Configure Clocks
    //**************************************************************************
    // Set ACLK to use REFO as its oscillator source (32KHz)
    UCS_initClockSignal(
            UCS_ACLK,                                    // Clock you're configuring
            UCS_REFOCLK_SELECT,                          // Clock source
            UCS_CLOCK_DIVIDER_1                          // Divide down clock source by this much
    );

    // Set REFO as the oscillator reference clock for the FLL
    UCS_initClockSignal(
            UCS_FLLREF,                                  // Clock you're configuring
            UCS_REFOCLK_SELECT,                          // Clock source
            UCS_CLOCK_DIVIDER_1                          // Divide down clock source by this much
    );

    // Set MCLK and SMCLK to use the DCO/FLL as their oscillator source (8MHz)
    // The function does a number of things: Calculates required FLL settings; Configures FLL and DCO,
    // and then sets MCLK and SMCLK to use the DCO (with FLL runtime calibration)
    UCS_initFLLSettle(
            MCLK_DESIRED_FREQUENCY_IN_KHZ,               // MCLK frequency
            MCLK_FLLREF_RATIO                            // Ratio between MCLK and FLL's reference clock source
    );

    //    // Optional lab step set MCLK to run from REFO
    //    // This will make the LED blink very sloooowly in our while{} loop
    //    UCS_initClockSignal( UCS_BASE,
    //            UCS_MCLK,                                    // Clock you're configuring
    //            UCS_REFOCLK_SELECT,                          // Clock source
    //            UCS_CLOCK_DIVIDER_1                          // Divide down clock source by this much
    //    );

    // Select XT2 as SMCLK source
    // We have to Re-do this call ... Why? If you use UCS_initFLLSettle() to
    //   setup MCLK, it also configures SMCLK; therefore, you should call this
    //   function after setting up MCLK
    /*UCS_initClockSignal(
            UCS_SMCLK,
            UCS_XT2CLK_SELECT,
            UCS_CLOCK_DIVIDER_1
    );*/

    // Verify that the modified clock settings are as expected
    myACLK  = UCS_getACLK();
    mySMCLK = UCS_getSMCLK();
    myMCLK  = UCS_getMCLK();
}

If I uncomment this:

UCS_initClockSignal(
            UCS_SMCLK,
            UCS_XT2CLK_SELECT,
            UCS_CLOCK_DIVIDER_1
    );

Then the UART prints garbage. I checked SMCLK via UCS_getSMCLK() call and it is returning 8000000 as expected. Without the UCS_initClockSignal() the SMCLK returns 8192000 and UART runs fine.

Strangely, if I set XT2 crystal to run at 8192000 (same as working version), it stills prints garbage. I'm missing something?

Thanks!

P.S. below is the myUART.c function:

// ----------------------------------------------------------------------------
// uart.c   ('FR6989 Launchpad)
// ----------------------------------------------------------------------------

//***** Header Files **********************************************************
#include "myUart.h"
#include "string.h"

//***** Defines ***************************************************************
//#define MYUART_IDLE    0
//#define MYUART_WRITE   1
//#define MYUART_ECHO    2

//***** Function Prototypes ***************************************************
//static unsigned char Eol( unsigned char );

//***** Global Variables ******************************************************

static unsigned short txBufLen     = 0;                                         // Number of bytes left to output; decremented as each character is sent

//---------------------------------------------------------------------------------------------
// struct Uart_t myUart;
//
// This structure defines the resources used by the UART functions of the USCI_A port.
// The typedef is found in the associated header file (myUart.h). The goal was to try and
// encapsulate the various port settings into a single structure, so as to make it easier to
// port this code to a new device.
// - Some of the fields are are defined by the device (Base Address, Number of UART channels).
// - Others are defined by the hardware board layout - in most cases, the UARTs can actually be
//   assigned to a few different Port/Pin locations.
// - Finally, there are a number of "channel variables" which are used to indicate the status
//   of the port at runtime.
//---------------------------------------------------------------------------------------------
struct Uart_t myUart = {
                         NUM_CHANNELS,                                          // Number of Uarts on the device
                         .Channels[0] = { USCI_A0_BASE,                         // Base Address of USCI_A port
                                          GPIO_PORT_P4,                         // GPIO Port settings for TX pin
                                          GPIO_PIN4,
                                          NULL,                                 // F5229 peripheral pin configuration does not have multiple SEL bits
                                          GPIO_PORT_P4,                         // GPIO Port settings for RX pin
                                          GPIO_PIN5,
                                          NULL,                                 // F5229 peripheral pin configuration does not have multiple SEL bits
                                          0,                                    // Baud Rate
                                          0,                                    // Open - UART port has been opened and configured
                                          1,                                    // TxBusy -
                                          0,                                    // TxRDY
                                          1,                                    // RxBusy
                                          0,                                    // RxRDY
                                          NOECHO                                // RxEcho
                                        },
                         .Channels[1] = { USCI_A1_BASE,                         // Base Address of USCI_A port
                                          GPIO_PORT_P3,                         // GPIO Port settings for TX pin
                                          GPIO_PIN4,
                                          NULL,                                 // F5229 peripheral pin configuration does not have multiple SEL bits
                                          GPIO_PORT_P3,                         // GPIO Port settings for RX pin
                                          GPIO_PIN5,
                                          NULL,                                 // F5229 peripheral pin configuration does not have multiple SEL bits
                                          0,                                    // Baud Rate
                                          0,                                    // Open - UART port has been opened and configured
                                          1,                                    // TxBusy -
                                          0,                                    // TxRDY
                                          1,                                    // RxBusy
                                          0,                                    // RxRDY
                                          DOECHO                                // RxEcho
                                        }
                       };

// The following structure will configure the USCI_A port to run at 9600 baud from an 8MHz SMCLK
// The baud rate values were calculated at: software-dl.ti.com/.../index.html
USCI_A_UART_initParam myUart_Param_9600_8N1_SMCLK8MHz = {
    USCI_A_UART_CLOCKSOURCE_SMCLK,
    52,                                                                         // clockPrescalar
    1,                                                                          // firstModReg
    0,                                                                         // secondModReg
    USCI_A_UART_NO_PARITY,
    USCI_A_UART_LSB_FIRST,
    USCI_A_UART_ONE_STOP_BIT,
    USCI_A_UART_MODE,
    USCI_A_UART_OVERSAMPLING_BAUDRATE_GENERATION
};

// The following structure will configure the USCI_A port to run at 115200 baud from an 8MHz SMCLK
// The baud rate values were calculated at: software-dl.ti.com/.../index.html
USCI_A_UART_initParam myUart_Param_115200_8N1_SMCLK8MHz = {
    USCI_A_UART_CLOCKSOURCE_SMCLK,
    4,                                                                         // clockPrescalar
    3,                                                                          // firstModReg
    5,                                                                         // secondModReg
    USCI_A_UART_NO_PARITY,
    USCI_A_UART_LSB_FIRST,
    USCI_A_UART_ONE_STOP_BIT,
    USCI_A_UART_MODE,
    USCI_A_UART_OVERSAMPLING_BAUDRATE_GENERATION
};

// The following structure will configure the USCI_A port to run at 9600 baud from an 32KHz ACLK
// The baud rate values were calculated at: software-dl.ti.com/.../index.html
USCI_A_UART_initParam myUart_Param_9600_8N1_ACLK32Kz = {
    USCI_A_UART_CLOCKSOURCE_ACLK,
    3,                                                                          // clockPrescalar
    0,                                                                          // firstModReg
    3,                                                                        // secondModReg
    USCI_A_UART_NO_PARITY,
    USCI_A_UART_LSB_FIRST,
    USCI_A_UART_ONE_STOP_BIT,
    USCI_A_UART_MODE,
    USCI_A_UART_LOW_FREQUENCY_BAUDRATE_GENERATION
};

//*****************************************************************************
// myUart_init()
//
// Initialize the UART functionality of the USCI peripheral
// - The "myUart_Instance" parameter allows the user to setup any of the UARTs
//   (Two UARTS are available on the 'FR6989)
// - This function verifies that the DriverLib UART init function returns
//   successfully
// - Waiting for the UART to send data can be done with either "polling" or
//   "interrupts"; this init routine enables the USCI UART interrupts
//*****************************************************************************
int myUart_init( uint16_t myUart_Instance, uint32_t BaudRate, USCI_A_UART_initParam *param )
{
    // Get this channel's USCI's base address from myUart structure
    uint16_t BaseAddr = myUart.Channels[myUart_Instance].BaseAddress;

    // Abort and return an error if the channel has already been initialized
    if( myUart.Channels[myUart_Instance].Open )
        return( STATUS_ALREADY_OPEN );

    // Initialize the UART using one of the two sets of parameters provided (or modify the parameters above to meet your needs)
    if( STATUS_FAIL == USCI_A_UART_init( BaseAddr, param ))
        return( STATUS_INIT_FAILED );

    // Baud rate retained for future clock adjustment function
    myUart.Channels[myUart_Instance].BaudRate = BaudRate;

    // Enable (i.e. turn on) the UART
    USCI_A_UART_enable( BaseAddr );

    // Set the status flags for this instance of our UART channel
    myUart.Channels[myUart_Instance].Open = 1;                                  // Indicate the port has been opened and initialized
    myUart.Channels[myUart_Instance].TxBusy = 0;                                // Set TX port to "not busy" (since we are not actively sending data, yet)
    myUart.Channels[myUart_Instance].RxBusy = 0;                                // Set RX port to "not busy" (since we are not actively receiving data, yet)
    myUart.Channels[myUart_Instance].TxRDY = 1;                                 // TX port is ready by default, since the transmit buffer is empty)
    myUart.Channels[myUart_Instance].RxRDY = 0;                                 // RX port is not ready by default, as there's nothing yet to read

    // Return successful, if we made it this far
    return( STATUS_INIT_SUCCESSFUL );
}


//*****************************************************************************
// myUart_writeBuf()
//
// Configures UART to send a buffer of data
// - The USCI_A_UART_transmitData() DriverLib function handles sending one
//   byte of data, whereas this function will send an entire buffer
// - This is a 'blocking' function - that is, it does not exit until the whole
//   buffer has been sent; rather than a wait-loop, though, this function waits
//   using LPM0 (and the transmit interrupt)
// - If the UART is not busy sending data already, this function sends the
//   first byte of data, then lets the UART ISR send the rest of the data
//
// Parameters
// - myUart_Instance:  Let's you select which UART to send the buffer; no error
//                     checking is done, as it is assumed you successfully
//                     initialized the UART
// - *txBuf:           Buffer of data to be written to UART port; function
//                     checks that the buffer does not have a NULL address
// - BufLen:           How many bytes do you want to send (you don't have to
//                     send the whole buffer which was passed). If a value of
//                     zero is passed, the function will calculate the buffer
//                     length for you
// - doCrLf:           Do you want to send a Carriage Return and Linefeed
//                     after the data buffer has been sent? (1 Yes; 0 N0)
// - Return:           This function returns the number of characters sent
//*****************************************************************************
int myUart_writeBuf( uint16_t myUart_Instance, unsigned char *txBuf, uint16_t BufLen, int DoCrLf )
{
    uint16_t BaseAddr = myUart.Channels[myUart_Instance].BaseAddress;           // Get this channel's USCI's base address from myUart structure
    unsigned char out = 0;
    int ret = -1;                                                               // Variable which will hold return value for this function

    // Exit if there is no transmit buffer
    if( txBuf == NULL )
        return( STATUS_FAIL_NOBUFFER );

    // Exit the function if we're already busy writing, else set the 'busy' flag
    if ( myUart.Channels[myUart_Instance].TxBusy )
        return( STATUS_FAIL_BUSY );
    else
        myUart.Channels[myUart_Instance].TxBusy = 1;

    // Check if the transmit length was provided as a parameter; if it's zero,
    // calculate the size of the buffer (i.e. number of chars to transmit)
    if ( BufLen == 0 )
        txBufLen = strlen( (const char *)txBuf );
    else
        txBufLen = BufLen;

    // Add to transmit length for carriage return (enter) and linefeed, if requested by user
    if ( DoCrLf )
    {
        txBufLen += 2;
    }

    // Since 'txBufLen' is decremented during transfers, retain the original value
    ret = txBufLen;

    // Enable USCI_Ax TX interrupt
    USCI_A_UART_enableInterrupt( BaseAddr, USCI_A_UART_TRANSMIT_INTERRUPT);

    // Keep sending characters until complete
    while( txBufLen >> 0 )
    {
        if ( myUart.Channels[myUart_Instance].TxRDY == 1 )                      // Check if TX port is ready (if we got here, it should be ready)
        {
            myUart.Channels[myUart_Instance].TxRDY = 0;                         // Clear the ready bit now that we're planning to send a byte

            out = *txBuf;                                                       // Read from buffer (note that this reads past end of buffer if we're doing CRLF)
            txBuf++;                                                            // Move buffer pointer to next item to be sent

            if ( DoCrLf ) {                                                     // If doing CRLF, replace 'out' with the CR or LF
                if ( txBufLen == 2 )
        		    out = ASCII_LINEFEED;
        	    else if ( txBufLen == 1 )
        		    out = ASCII_ENTER;
            }

            txBufLen--;                                                         // Decrement the transmit count

            USCI_A_UART_transmitData( BaseAddr, out );                         // Send the data to the transmit port
            if ( myUart.Channels[myUart_Instance].TxRDY == 0 )                  // Test TxRDY to help prevent race condition where interrupt occurs before we reach this step
                __low_power_mode_0();                                           // Sleep CPU until woken up by transmit ready interrupt event
        }                                                                       // (other LPMx modes could be used, depending upon clock requirements)
    }

    // Disable the UART transmit interrupt
    USCI_A_UART_disableInterrupt( BaseAddr, USCI_A_UART_TRANSMIT_INTERRUPT);

    // Return the length of the string that was sent
    return (int) ret;
}


//*****************************************************************************
// myUart_readBuf()
//
// This function receives a buffer of data via the UART. This is a blocking
// function, thus it will not return until the full length has been received.
//
// Parameters:
// - myUart_Instance:  Let's you select which UART should recieve the buffer;
//                     no error checking is done, as it is assumed you
//                     successfully initialized the UART
// - *rxBuf:           Buffer that the received data should be written into;
//                     this function checks that the buffer doesn'tt have a
//                     NULL address (if so, it exits
// - *rxSize:          How many bytes do you want to receive; a default size
//                     of 1 line (80 bytes) is used if a "0" is passed;
//                     Note that receiving a carriage return or linefeed will
//                     force the function to stop receiving data, even if the
//                     'Length' of bytes has not yet been received;
//                     Finally, we used a pointer for the size so that the
//                     actual number of received bytes is returned
// - Return:           The status of the function
//*****************************************************************************
int myUart_readBuf( uint16_t myUart_Instance, unsigned char *rxBuf, uint16_t *rxSize )
{
  uint16_t BaseAddr = myUart.Channels[myUart_Instance].BaseAddress;             // Check if TX port is ready (if we got here, it should be ready)
  unsigned int  ret      = STATUS_INIT_SUCCESSFUL;                              // Variable to hold function status (initialize as 'successful')
  unsigned int  i        = 0;                                                   // Local variable used in 'for' loop
  unsigned char in[3]    = { 0, 0, 0 };                                         // Temporary variable to hold received data (only 1 byte will be used for rec'd data; extra locations to add CRLF)
  uint8_t       inLen    = 0;                                                   // Current length of "in" array
  uint16_t      rxBufLen = 0;                                                   // Current length of input buffer

    // Exit if there is no read buffer
    if( rxBuf == NULL )
        return( STATUS_FAIL_NOBUFFER );

    // Exit the function if we're already busy reading, else set the 'busy' flag
    if ( myUart.Channels[myUart_Instance].RxBusy )
        return( STATUS_FAIL_BUSY );
    else
        myUart.Channels[myUart_Instance].RxBusy = 1;

    // If '0' is passed as the "number of bytes to read", set to default size
    if ( *rxSize == 0 )
        *rxSize = DEFAULT_MAX_READ;

    // If recieve "echo" feature is enabled, wait until the transmit channel isn't busy
    if ( myUart.Channels[myUart_Instance].RxEcho ) {
        if ( myUart.Channels[myUart_Instance].TxBusy == 1 )
        {
            __low_power_mode_0();
        }
    }

    // Clear and enable USCI_Ax RX interrupt
    USCI_A_UART_clearInterrupt( BaseAddr, USCI_A_UART_RECEIVE_INTERRUPT);
    USCI_A_UART_enableInterrupt( BaseAddr, USCI_A_UART_RECEIVE_INTERRUPT);

    // Keep transmitting until the receive data buffer has reached the specified rxSize
    while ( rxBufLen < *rxSize )
    {
        // We 'missed' reading the data in time if RxRDY ever goes above '1'
        if ( myUart.Channels[myUart_Instance].RxRDY >> 1 )
            ret = STATUS_RX_MISSED_REAL_TIME;

        // If not ready, sleep until we get a receive interrupt event that sets the RxRDY flag
        if ( myUart.Channels[myUart_Instance].RxRDY == 0 ) {
            __low_power_mode_0();
        }
        else {
            myUart.Channels[myUart_Instance].RxRDY = 0;                         // If Rx is ready, clear the ready bit
            in[0] = USCI_A_UART_receiveData( BaseAddr );                       // Read byte from the RX receive buffer
            inLen = 1;                                                          // Set 'in' buffer length to '1' byte

            // If input byte is CR (or linefeed) add the other character to 'in'
            switch ( in[0] )
            {
                case ASCII_LINEFEED:
                    in[1] = ASCII_ENTER;
                    inLen++;                                                    // Increment the size of 'in' buffer length
                    *rxSize = rxBufLen;                                         // Set receive size to current buffer length to force the function to complete
                    break;

                case ASCII_ENTER:
                    in[1] = ASCII_LINEFEED;
                    inLen++;                                                    // Increment the size of 'in' buffer length
                    *rxSize = rxBufLen;                                         // Set receive size to current buffer length to force the function to complete
                    break;
            }

            // Copy 'in' character(s) to the data receive buffer
            for ( i = 1; i <= inLen; i++ ) {
                *( rxBuf + rxBufLen ) = in[i-1];
                rxBufLen++;
            }

           // If 'echo' is enabled, trasmit the newly received character(s) back to sender (for terminals without 'local echo')
           if ( myUart.Channels[myUart_Instance].RxEcho ) {
                if ( !myUart.Channels[myUart_Instance].TxBusy )                 // Wait until transmit isn't busy, before sending character(s)
                {
                    myUart_writeBuf( CHANNEL_1, (unsigned char *)in, inLen, NOCRLF );
                }
            }
        }
    }

    // Disable the RX interrupt and set the port to 'not busy'
    USCI_A_UART_disableInterrupt( BaseAddr, USCI_A_UART_RECEIVE_INTERRUPT);
    myUart.Channels[myUart_Instance].RxBusy = 0;

    // Return with status
    return ( ret );
}


/*//*****************************************************************************
// USCI_A0 Interrupt Service Routine
//*****************************************************************************
#pragma vector = USCI_A0_VECTOR
__interrupt void myUart0_isr(void)
{
	int chan = 0;

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

        // UART receive interrupt
        case USCI_UCRXIFG:

            myUart.Channels[chan].RxRDY++;                                      // Interrupt tells us that that the UART RX buffer is ready to read
            break;

        // UART transmit interrupt
        case USCI_UCTXIFG:

            myUart.Channels[chan].TxRDY = 1;                                    // Interrupt tells us that that the UART TX buffer is available for writing
            if ( txBufLen == 0 )
                myUart.Channels[chan].TxBusy = 0;                               // Set the Tx as 'not busy' if full buffer has been transfered
            break;
//
//        case USCI_UART_UCSTTIFG:
//            __no_operation();
//            break;
//
//        case USCI_UART_UCTXCPTIFG:
//            __no_operation();
//            break;
    }

    // Exit low-power mode:
    //   Now that we either have received a byte - or are ready to transmit
    //   a another byte - we need to wake up the CPU (since our read/write
    //   routines enter LPM while waiting for the UART to do its thing)
    _low_power_mode_off_on_exit();

}*/

//*****************************************************************************
// USCI_A1 Interrupt Service Routine
//*****************************************************************************
#pragma vector = USCI_A1_VECTOR
__interrupt void myUart1_isr(void)
{
	int chan = 1;

    switch ( __even_in_range( UCA1IV, USCI_UCTXIFG ))
    {
        case USCI_NONE:
        	break;

        // UART receive interrupt
        case USCI_UCRXIFG:

            myUart.Channels[chan].RxRDY++;                                      // Interrupt tells us that that the UART RX buffer is ready to read
            break;

        // UART transmit interrupt
        case USCI_UCTXIFG:

            myUart.Channels[chan].TxRDY = 1;                                    // Interrupt tells us that that the UART TX buffer is available for writing
            if ( txBufLen == 0 )
                myUart.Channels[chan].TxBusy = 0;                               // Set the Tx as 'not busy' if full buffer has been transfered
            break;
//
//        case USCI_UART_UCSTTIFG:
//            __no_operation();
//            break;
//
//        case USCI_UART_UCTXCPTIFG:
//            __no_operation();
//            break;
    }

    // Exit low-power mode:
    //   Now that we either have received a byte - or are ready to transmit
    //   a another byte - we need to wake up the CPU (since our read/write
    //   routines enter LPM while waiting for the UART to do its thing)
    _low_power_mode_off_on_exit();

}


Linux/TMP75: temperature sensor porting confer (Android OS)

$
0
0

Part Number:TMP75

Tool/software: Linux

Hi 

excuse me, recently I try to porting tmp75 into Android OS, some of information as below

OS: android 6.0.1

linux version: 4.1.15

the first step probe driver already finished, and the power gpio was set finished, but when enter to system, the log as below 

and the attachment file is my tmp75 driver (lm75.c / lm75.h)

could any one help me to check why the  "thermal_zone_of_sensor_register()" could get error (the red number [ 4.772457] data->tz is -19 )

4.675158] **********enter dm5150_switch_AUX(cvbs)
[ 4.680067] **********cvbs is 1
[ 4.683687] dm5150 CVBSin1 (Mux0)
[ 4.687127] ***********enter dm5150_get_std in dm5150_switch_AUX()
[ 4.693935] tmp is 0
[ 4.696133] Got invalid video standard!
[ 4.707995] VD_MISC : 0x06
[ 4.710725] ********in ioctl_g_fmt_cap
[ 4.715854] mxc_v4l2_output v4l2_out: V4L2 device registered as video16
[ 4.722700] mxc_v4l2_output v4l2_out: V4L2 device registered as video17
[ 4.729755] usbcore: registered new interface driver uvcvideo
[ 4.735516] USB Video Class driver (1.1.1)
[ 4.740640] **********************add lm75 driver*********************
[ 4.747357] ******start probe tmp75******
[ 4.751382] in probe switch******
[ 4.754707] kind is 19
[ 4.757101] choose tmp75
[ 4.759645] ********in lm75_read_value
[ 4.763402] 1
[ 4.765620] ********probe status is 0
[ 4.769793] Config 0x60
[ 4.772457] data->tz is -19
[ 4.775264] data->tz is error******
[ 4.778792] 8??5%?
[ 4.782207] imx2-wdt 20bc000.wdog: timeout 60 sec (nowayout=0)
[ 4.788660] device-mapper: uevent: version 1.0.3
[ 4.793701] device-mapper: ioctl: 4.31.0-ioctl (2015-3-12) initialised: dm-devel@redhat.com
[ 4.802263] Bluetooth: HCI UART driver ver 2.3
[ 4.806746] Bluetooth: HCI UART protocol H4 registered
[ 4.811897] Bluetooth: HCI UART protocol BCSP registered
[ 4.817243] Bluetooth: HCI UART protocol ATH3K registered
[ 4.822768] usbcore: registered new interface driver btusb
[ 4.828502] sdhci: Secure Digital Host Controller Interface driver
[ 4.834700] sdhci: Copyright(c) Pierre Ossman

REALLY THX

(Please visit the site to view this file)

(Please visit the site to view this file)

TXS0108E: I2C Communication Issue

$
0
0

Part Number:TXS0108E

Hi,

I am using TXS01018E to translate I2C lines from 1.8V to 3.3V level.

We observe that the communication is not so consistent. There is no pull up on either on the sides of translator.

If I want to tune the rise time how can I select external pull up resistor?

Regards,

Jenitt Maria francis

UCC28063: UCC28063 Circuit review: output Cap-less (20uF ↓)

$
0
0

Part Number:UCC28063

Hi 

UCC28063 is designing a circuit with 420V output.(Typ. 270W, Peak 460W))

Request circuit review.

There seems to be a lot of noise in the current GND pattern.

Since the concept of this circuit is small, I want to design it to 20uF or less. In the current state, when the load is increased by about 130 W, ic is dead. Could it be improved? Could it be due to the noise of this pattern?

Adding an output capacitor in the circuit resulted in a normal output. But I want to design with Cap-less.

Schematic diagrams and patterns are also attached.(Please visit the site to view this file)(Please visit the site to view this file)

RM57L843: some MCU Architecture Questions about TCM

$
0
0

Part Number:RM57L843

Neither of the datasheet or TRM mentioned the TCM(Tightly Coupled Memory). So I am asking some questions:

  1. Does the L2SRAM use the port for A TCM?
  2. Does the Flash use the ports for B TCM?
    1. From the MCU block diagram, I can see Flash uses two ports, so are they using the B0TCM and B1TCM?
  3. From the ARM Cortex-R programer's guide,  there is a section comparing the performance between cache and TCM. Does it imply that the TCM is accessed directly without cache operation?
    1. so if the L2SRAM and flash are connecting R5F core via TCM ports, are they cached?
  4. I also checked the datasheet and TRM for RM48. Both the document mentioned the details of  the relationship between TCM and Flash or TCM and L2SRAM. But why the details like that are omitted in the document of RM57? Does the implementation changes a lot?

LM4050-N-Q1: How to use it as a low current negative LDO?

$
0
0

Part Number:LM4050-N-Q1

Hi team,

I want to use LM4050 as a negative LDO. I draw the block like below. Is it the right way to use LM4050? What do I need to pay attention about this circuit?

The -7V is the output of the isolation DCDC, and it is not very accurate and have some ripples @400kHz. 

Regards

Michael

Starterware/CC1350: PWM Support

$
0
0

Part Number:CC1350

Tool/software: Starterware

Dear Support:

It's not clear from reading the data sheet - can you tell me how many PWM outputs can be supported with the CC1350 and CC2650?  In providing me a number, can you provide a reference as to how you came up with the number?

Thanks,
Tim

Linux/WILINK8-WIFI-NLCP: WL18xx WILINK8-WIFI-NLCP

$
0
0

Part Number:WILINK8-WIFI-NLCP

Tool/software: Linux

Hi,

I have a question with the Wi-Fi driver (WILINK 8 - WIFI - NLCP) for Wilink8.

WiLink8 R8_7_SP2 is described as corresponding to Linux Kernel ver4.4.8,
Do you also support Linux Kernel ver 3.1.4?

Best Regards,

hamada


LP5562: Do LP5562 has the same function to XRP7620 ?

$
0
0

Part Number:LP5562

Hi TI Folks,

  Good day to you.

  As per design requirement, we are looking for a LED Driver:

(1)3.3VDC input

(2)Linear drive to LED

(3)Average 25mA LED driven current,

(4)I2C control interface,

  The EXAR brand MPN XRP7620 can meet above requirement, I would like to look for the same function solution from TI, please advise do TI has the suitable MPN ? Do TI LP5562 be a suitable solution?

Best regards

Jiang WeiJi

TPA3131D2: Max and Min value @ ton Turn-on time SDZ=2 V

$
0
0

Part Number:TPA3131D2

Hi all

Would you mind if we ask TPA3131D2?

How much is the maximum and minimum value about  ton(Turn-on time) with SDZ=2 V?
The datasheet only shows typ data.
If you have some reference data, could you share us?

kind regards,

Hirotaka Matsumoto

DP83848Q-Q1: compliance test for 100Base-TX -(2)

$
0
0

Part Number:DP83848Q-Q1

Hi Team,

The following thread describes about compliance test for 100Base-TX.
https://e2e.ti.com/support/interface/ethernet/f/903/p/491013/1773271?tisearch=e2e-quicksearch&keymatch=Pseudo#1773271

In the following each test item, I believe DP83848Q-Q1 generates test pattern itself and it isn't required to be gererated by external microprocessor.
Is my understanding correct?

ANSI X3.263-1995: Annex J AOI Template, 9.1.6 Rise Time, 9.1.6 Fall Time, 9.1.6 Rise Fall Symmetry, 9.1.9 Transmit Jitter
ANSI X3.263-1995: 9.1.2.2 Differential Output Voltage, 9.1.4 Signal Amplitude Symmetry, 9.1.3 Waveform Overshoot
ANSI X3.263-1995: 9.1.8 Distortion (Duty Cycle)
ANSI X3.263-1995: 9.1.5 Transmitter Return Loss, 9.1.5 Receiver Return Loss

Best Regards,
Yaita / Japan disty

66AK2G02: Unused pins (signals)

$
0
0

Part Number:66AK2G02

Can a pin written as "PU or PD"(Table4-1 in DataSheetSPRS932E) be unconnected (left unconnected)?


How can I connect the following pins? (PullUp , PullDown , Open ...  etc)

Clock
   CPTS_REFCLK_P/_N
   DDR_CLK_P/_N
   MLBP_CLK_P/_N
   PCIE_CLK_P/_N
   SYSCLK_P/_N
   USB0_XO , USB1_XO
DDR
   DDR3_CBDQM , DDR3_CBDQS_P/_N , DDR3_CB03-_CB00 , DDR3_D31-_D17 , DDR3_DQS2_P/_N , DDR3_DQS3_P/_N
USB
   USB0_TXRTUNE_RKELVIN , USB0_VBUS , USB1_TXRTUNE_RKELVIN , USB1_VBUS
I/O
   DSS_DATA6 , DSS_DATA7
MLBP
   MLBP_DATA_P/_N , MLBP_SIG_P/_N
PCIe
   PCIE_REFRES , PCIE_RXP0/_RXN0

BQ25606: I do not want to use USB related things here, is my implementation right?

$
0
0

Part Number:BQ25606

Hello, I'm planning to use BQ25606RGE as a battery charger and power supplier for my system.

My 12V 1A wall adapter is the primary source and will be connected to VBUS of BQ25606.

After that , it will charge LI-PO battery and provide Vsys rail for my devices through BQ25606.

By the way, I don't need any USB related things such as OTG, D+, D- pins. 

Datasheet says 1. I can limit input current through ILIM pin if I don't use D+, D- pins  2. OTG pin should not be floated.

Here are my questions.

1. In this case what should I do to those pins(OTG, D+, D-)? (My expectation is make OTG grounded and D+ D- shorted)

2. How much this implementation provide power for Vsys rail ? is it sufficient to provide power for my requirement?(5V, 1.2A)  

3. Should I set Input current limit to 1A(Rlim = 487ohm) or greater?

TUSB9261DEMO: USB Compile tool

TS3A27518E: Issues connecting high speed uSD to Nikon cameras at 100MHz clock

$
0
0

Part Number:TS3A27518E

We are trying to utilise a TS3A27518E to switch a uSD card (com channel) between either our own controller (NC channel) or a camera's SD slot (NO channel) so that we can read photos back from the SD card when required.

With slower uSD Class 4 cards, everything works fine for a variety of cameras (and a clock speed of up to 50MHz) proving that the hardware connections are fine. However, for HC-I bus cards, the circuit is failing when it tries to switch clock/data lines from 3.6v to 1.8V and ramp up the clock speed to 100MHz. Although the tracks are short and a ground plane is used, my guess is there is too much parasitic capacitance as viewing the clock signal shows that the clock sometimes has a reduced amplitude of 1.0v (down from 1.8v) and also has a DC bias. I was considering using a low forward voltage schottky diode to remove the DC bias but this will also introduce a phase delay that I suspect would be too much at 100MHz.  Has anyone had any success in using this type of switch for low voltage (1.8V) and high speed (100MHz) SD signals? I was wondering if I should have used two TS3A44159 devices instead as that has a lower R(on) of 0.3 ohms.

Although the circuit board allows for pull-ups, no pull-up or pull-down resistors are used on the data lines.

RHS screenshot: Ch1 is input to switch, Ch3 is the output.

  

Appreciate any ideas anyone might have to resolve this.

Thanks!!

Paul


REF102: Solderability test report for MPN: REF102BP

$
0
0

Part Number:REF102

hi,

Can I check if I can get the solderability test report for REF102BP device?

End customer want to know if this part following one of the both standard CEI-68-2-54 or JESD-22-B102.

best regards,

kpk

TUSB1310A: Want to use only USB3.0 part of the PHY

$
0
0

Part Number:TUSB1310A

Is it possible to use only the USB3.0 part of the PHY and not connect any of the USB2.0 PHY signals. 

From the datasheet I could determine what to do for most of the signals except a few.

Do I connect DM and DP to ground with a resistor if not used.

How do I connect VBUS if not used and will it influence the USB3.0 side.

Is the PHY_RESETn signal only for the USB2.0 PHY side or also for the USB3.0 side.

Anything else I should look out for if connecting only USB3.0 PHY.

Thanks

Manie

MSP432P401M: Size limitation of SD card

$
0
0

Part Number:MSP432P401M

Hello Everyone,

           I am working on MSP432P401M microcontroller. I want to interface SD card (FAT32 format) to msp432 using SPI communication.What is the size limitations (capacity) of SD card when interface with controller?? Can we connect 32GB Sd card to MSP432P401M controller??Volume size of SD card is depend on FAT format??

Thanks

LMR16020: Output capacitor formula

$
0
0

Part Number:LMR16020

Hi friends,

I have my doubt about the formula of output capacitor in the datasheet as attached.

If IOH=2A, IOL=0.2A, Vout=50v, Vos=250mV, L=9.55uH, the value that I calculated based on equation 12 is 108uF(fsw=200k),not 36uF, and the value that I calculated based on equation 13 is 1.5089uF, not 7.7uF, did I misunderstand? Please kindly explain the formula for me.

Best Regards,

Thanks

CC2530: break package mechanism .

$
0
0

Part Number:CC2530

Hi Team
If data package  is  large ,  this data break a package into many  package .  I want to understand this break package mechanism . How does merge data in rx end device . How distribute nwkSeqNum?
BR,
Alvin
Viewing all 262198 articles
Browse latest View live


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