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

about CC1101

$
0
0

A receiver, a transmitter, is now connected by a SMA connector, and the SMA connector is connected to the antenna end, and the receiver can't receive the signal, so to ask the question, what caused the problem?


about cc1101

$
0
0

CC1101, one is the receiving terminal, the other is the transmitter side. Now we connect it through the SAM interface, SAM is connected to the antenna, but after receiving the connection, the receiving terminal finds no signal, and has already set the low power consumption through software. What is the reason for this?

SN74CBT3251: Switching frequency ability

$
0
0

Part Number:SN74CBT3251

Hi there:

We're looking for an solution with 1:8 Mux/De-Mux Bus switch, original solution: SN74CB3Q3251 couldn't support up to 25MHz.

Dose SN74CBT3251 could support switching frequency to 25MHz?  (only found the description as following in the datasheet 

  • High-Bandwidth Data Path (up to 500 MHz )

TXS0108E: TXS0108E Input and Output Waveform Problem

$
0
0

Part Number:TXS0108E

Hi team,

I have a question of TXS0108E. Here is the test system.

We found that there will be a slow rising edge for the first pulse, but the second one didn't have. The waveform is like this. The blue one is the D0 on the CPU side and the yellow one is the D0 on the FLASH side. They both have a slow rising edge.

The rising edge is like this

And we found that this will occur on the both input and output side.

But when they removed the TXS0108E. There will be no problem.

Do you have any suggestion about this?

Thank you

Best Regards

Jack Chen

TMS320F28069M: Question about DRV8412-C2-KIT with InstaSPIN-MOTION

$
0
0

Part Number:TMS320F28069M

Hi all,

Currently I am using InstaSPIN-MOTION's Lab13b to turn the customer's two-phase stepping motor.
Although it operates with the following configuration, it stops (step out) at about 200 RPM.

Please let me know the following.

(1) Can I turn the motor at 1500 RPM with this configuration?

(2) In that case, which parameter should be adjusted?
I tried changing the BW(Band width) value, but the behavior did not change.

(3) Which is easier when turning the motor at 1500 RPM in case of program based on this configuration
or customizing the program based on the following program?
C:\ti\controlSUITE\development_kits\DRV8412-C2-KIT_v131\Stepper

Best regards,

Sasaki

SN74LS273: Does TI have parts similar to SN74LS273 but with input voltage at 3.3V

AM3358: How to use I2C1 in PRU

$
0
0

Part Number:AM3358

Hello,

I'm initializing i2c-1 of am3358 in PRU Core.

Where I'm able see Slave address on sda pin using DSO.

But i cannot receive ACK. Always return with NACK

While the same hardware works on different setup.

Here i've attached my code.

#include "main.h"
#include "hw_types.h"
#include "error.h"
#include "delay.h"
#include "hsi2c.h"
#include "hw_hsi2c.h"
#include "hw_cm_per.h"

#define I2C0_BUS    0
#define I2C1_BUS    1

#define DELAY_MILLI_SEC     1

#define I2C_TIMEOUT     5

#define SUCCESS     1
#define FAIL        0


/** **************************************************************************
 * clockInit
 *
 * brief
 *
 * This routine initializes the clock part for I2C on the Bases of BUS number
 *
 * Parameter busNum     [IN]    Bus Instance number
 *
 * Return
 *   NA
 *
 */

void clockInit
(
    uint8_t    busNum
)
{
#ifdef centarus
    HWREG(PINCNTL263) = I2C0_PIN_EN;
    HWREG(PINCNTL264) = I2C0_PIN_EN;

    /*Ensure the module is enabled and the clock to it is also enabled*/
    HWREG(PRCM + CM_PER_I2C0_CLKCTRL) =
                CM_PER_I2C0_CLKCTRL_MODULEMODE_ENABLE;

    DELAYMilliSeconds(I2C_TIMEOUT);

    /* Check the state is changed */
    while (HWREG(CM_ALWON_I2C_0_CLKCTRL) & CM_PER_I2C2_CLKCTRL_IDLEST);

    DELAYMilliSeconds(DELAY_MILLI_SEC);

    *(uint32_t*)(PRCM + CM_PER_I2C1_CLKCTR) =
                CM_PER_I2C0_CLKCTRL_MODULEMODE_ENABLE;

    DELAYMilliSeconds(I2C_TIMEOUT);

    /* Check the state is changed */
    while ((*(uint32_t*) CM_ALWON_I2C_1_CLKCTRL) & CM_PER_I2C2_CLKCTRL_IDLEST);

    DELAYMilliSeconds(DELAY_MILLI_SEC);


#else

//    switch (busNum)
//    {
//        case I2C0_BUS:
            /*Ensure the module is enabled and the clock to it is also enabled*/
            HWREG(SOC_PRCM_REGS + CM_PER_I2C1_CLKCTRL) = CM_PER_I2C1_CLKCTRL_MODULEMODE_ENABLE;
//            break;
//        case I2C1_BUS:
            /*Ensure the module is enabled and the clock to it is also enabled*/
            HWREG(SOC_PRCM_REGS + CM_PER_I2C2_CLKCTRL) = CM_PER_I2C2_CLKCTRL_MODULEMODE_ENABLE;
//            break;
//    }

    /* Wait till clock is inactive */
    while(((HWREG(SOC_PRCM_REGS + CM_PER_L4LS_CLKSTCTRL)) & CM_PER_L4LS_CLKSTCTRL_CLKACTIVITY_I2C_FCLK)
            == CM_PER_L4LS_CLKSTCTRL_CLKACTIVITY_I2C_FCLK_INACT);

#endif
}


/** **************************************************************************
 * int16_t i2cInit()
 * brief Routine to initialize the I2C
 *
 * This routine initializes the I2C instance as per given bus number.No use of
 * interrupts here as the code is intended to carry out all I/O operations
 * in polled mode.
 *
 * Parameter busNum     [IN]    Bus Instance number
 *
 * Return
 *       return SUCCESS for success  - Description
 *       return FAIL for error   - Description
 */
int16_t I2CInit
(
    uint8_t   busNum
)
{
    int16_t   retVal = SUCCESS;
    uint16_t  sclValues = 0;
    uint32_t  baseI2c = 0;
    uint8_t   flag=0;
    uint16_t  delayCnt = 1000;

    switch (busNum)
    {
        case I2C0_BUS:
            baseI2c = SOC_I2C_0_REGS;
            break;
        case I2C1_BUS:
            baseI2c = SOC_I2C_1_REGS;
            break;
        default:
            retVal = E_INVALID_PARAM;
            return retVal;
    }

    if (SUCCESS == retVal)
    {
#ifdef centarus
        ;
#else
        /* Setting PINMUX Required for I2C*/
//        pinmuxSetting(busNum);
#endif
        /*Setting Clock as Required for I2C to Work*/
        clockInit(busNum);

        /* Reset all the registers */
        HWREG(baseI2c + I2C_CON) = 0;
        HWREG(baseI2c + I2C_PSC) = 0;
        HWREG(baseI2c + I2C_SCLL) = 0;
        HWREG(baseI2c + I2C_SCLH) = 0;
        HWREG(baseI2c + I2C_BUF) = 0;
        HWREG(baseI2c + I2C_SYSC) = 0;
        HWREG(baseI2c + I2C_WE) = 0;
        HWREG(baseI2c + I2C_IRQSTATUS) = 0;

        delay_ms(1);
        /* soft-reset the I2c Controller */
        HWREG(baseI2c + I2C_SYSC) = I2C_SYSC_SRST;

        /*  I2C requires to be enabled for reset to complete */
        HWREG(baseI2c + I2C_CON) = I2C_CON_I2C_EN;

        /* wait for  reset  */
        while (I2C_SYSC_SRST_RESET != flag)
        {
            flag = ( HWREG(baseI2c + I2C_SYSC)  & I2C_SYSC_SRST_RESET) ;
            delayCnt--;
            delay_ms(1);
            if (delayCnt <= 0)                break;
        }
        if (delayCnt == 0)
        {
            retVal = FAIL;
            return(retVal);
        }
        delay_ms(I2C_TIMEOUT);


        /* Wake Up*/
        HWREG(baseI2c + I2C_SYSC) = I2C_SYSC_ENAWAKEUP;
//            |I2C_SYSC_AUTOIDLE
//        /*NO IDLE MODE*/
//            | (I2C_SYSC_IDLEMODE_SMARTIDLE << I2C_SYSC_IDLEMODE_SHIFT);
//        /*CLOCK ACTIVITY IN FUNCTIONAL MODE*/
//            | (I2C_SYSC_CLKACTIVITY_FUNC << I2C_SYSC_CLKACTIVITY_SHIFT);


        /* Disable the controller */
        HWREG(baseI2c + I2C_CON) = 0;

        /* compute the PSC value */
//        if (HSI2C_BUS_CLOCK > I2C_TIMEOUT)
//        {
            /* I2C PRESCALE settings. */
            HWREG(baseI2c + I2C_PSC) = 0xb;//HSI2C_PRESCALE_DIV1;
//            sclValues = HSI2C_INTERNAL_CLOCK1 / HSI2C_BUS_CLOCK;
//        }
//        else
//        {
//            /* I2C PRESCALE settings. */
//            HWREG(baseI2c + I2C_PSC) = HSI2C_PRESCALE_DIV2;
//            sclValues = HSI2C_INTERNAL_CLOCK2 / HSI2C_BUS_CLOCK;
//        }

        /* Disable  & clear all the Interrupts */
        HWREG(baseI2c + I2C_IRQENABLE_CLR) = 0xFFFFFFFF;//HSI2C_IRQDISABLE_ALL;

        /* set the SCL Low and High time */
        HWREG(baseI2c + I2C_SCLL) = 0xd;
        HWREG(baseI2c + I2C_SCLH) = 0xf;
//        HWREG(baseI2c + I2C_SCLL) = sclValues - HI2C_SCLL_VAL;
//        HWREG(baseI2c + I2C_SCLH) = sclValues - HI2C_SCLH_VAL;

        /* Set the self address */
        HWREG(baseI2c + I2C_OA) = 0;//I2C_OA_OA & OWN_ADD;

        /* Enable the I2C controller */
        HWREG(baseI2c + I2C_CON) = I2C_CON_I2C_EN;

        /* set the slave address */
        HWREG(baseI2c + I2C_SA) = (int16_t) NULL;;

        /* Set data count */
        HWREG(baseI2c + I2C_CNT) = (int16_t) NULL;

        HWREG(baseI2c + I2C_WE) = I2C_WE_AL | I2C_WE_NACK | I2C_WE_ARDY | I2C_WE_DRDY ;
    }
    return (retVal);
}

void DELAYSeconds(int sec)
{
    int k=0;
    for(k=0;k<2000;k++){}
}

typedef enum {
    I2C_TRANSFER_SUCCESS=0,
    I2C_ARBITRATION_LOST,
    I2C_NACK_RECEIVED,
    I2C_ACCESS_ERROR,
    I2C_BUS_BUSY,
    I2C_RECEIVE_OVERRUN,
    I2C_TIMEOUT_ERROR,
    I2C_INVALID_PARAM,
    I2C_AAS_SLAVE_ADDR,
    I2C_INVALID_ERROR
}I2C_ERROR_CODE_Type;

uint32_t I2C_GetBaseAddress(uint8_t busNum)
{
uint32_t baseI2c=0;
    switch (busNum)
    {
        case I2C0_BUS:
            baseI2c = SOC_I2C_0_REGS;
            break;
        case I2C1_BUS:
            baseI2c = SOC_I2C_1_REGS;
            break;
        default:
            return I2C_INVALID_PARAM;
    }
return baseI2c;
}
I2C_ERROR_CODE_Type I2C_ErrorHandling(uint32_t baseAddress)
{
uint32_t status=0;
    status = HWREG(baseAddress + I2C_IRQSTATUS);

    if (I2C_IRQSTATUS_RAW_AL_LOST == (status & I2C_IRQSTATUS_RAW_AL)) {
        HWREG(baseAddress + I2C_IRQSTATUS) |= I2C_IRQSTATUS_RAW_AL;
        return I2C_ARBITRATION_LOST;
    }
    if (I2C_IRQSTATUS_RAW_AERR == (status & I2C_IRQSTATUS_RAW_AERR)) {
        HWREG(baseAddress + I2C_IRQSTATUS) |= I2C_IRQSTATUS_RAW_AERR;
        return I2C_ACCESS_ERROR;
    }
    if (I2C_IRQSTATUS_RAW_NACK == (status & I2C_IRQSTATUS_RAW_NACK)) {
        HWREG(baseAddress + I2C_IRQSTATUS) |= I2C_IRQSTATUS_RAW_NACK;
        return I2C_NACK_RECEIVED;
    }
    if(I2C_IRQSTATUS_RAW_ROVR == (status & I2C_IRQSTATUS_RAW_ROVR)) {
        HWREG(baseAddress + I2C_IRQSTATUS) |= I2C_IRQSTATUS_RAW_ROVR;
        return I2C_RECEIVE_OVERRUN;
    }
    if(I2C_IRQSTATUS_RAW_AAS == (status & I2C_IRQSTATUS_RAW_AAS)) {
        HWREG(baseAddress + I2C_IRQSTATUS) |= I2C_IRQSTATUS_RAW_AAS;
//        return I2C_AAS_SLAVE_ADDR;
    }
return I2C_TRANSFER_SUCCESS;
}

/** **************************************************************************
 * \n \brief Routine to read data from slave device the I2C - 0
 *
 * This routine initializes the I2C controller for reading from the slave
 * peripheral connected to the bus. This function takes the slave address
 * as a parameter along with the read buffer pointer and the length of buffer.
 * This function returns the number of bytes read into the output length pointer.
 *
 * busNum       [IN]        I2C Bus number
 * slaveAddr    [IN]        I2C Slave address to read from
 * buffer       [OUT]       Buffer pointer to copy data into
 * bufLen       [IN]        Length of the input buffer pointer
 * pDataRead    [OUT]       Place holder to return read number of bytes
 *
 * \return
 * \n      return SUCCESS for success  - Description
 * \n      return FAIL for error   - Description
 */
I2C_ERROR_CODE_Type I2CRead
(
    uint8_t   busNum,
    uint16_t  slaveAddr,
    uint8_t   *buffer,
    uint8_t   bufLen,
    uint8_t   *pDataRead
)
{
    I2C_ERROR_CODE_Type retVal = I2C_TRANSFER_SUCCESS;
    uint16_t status = 0;
    uint8_t bytesRead = 0;
    uint8_t* pDataPtr = NULL; /*Pointer to save received data*/
    uint32_t  timeOut = I2C_TIMEOUT;
    uint32_t  baseI2c = 0;

    /* input parameter validation */
    if ((NULL != buffer) && (0 != bufLen) && (NULL != pDataRead)){
        pDataPtr = buffer;
    }else{
        return I2C_INVALID_PARAM;
    }

    baseI2c = I2C_GetBaseAddress(busNum);
    if(baseI2c == I2C_INVALID_PARAM)    return I2C_INVALID_PARAM;

    /*  set the slave address */
    HWREG(baseI2c + I2C_SA) = slaveAddr & I2C_SA_SA;

    /* set the count */
    HWREG(baseI2c + I2C_CNT) = bufLen;

    /* Poll for the bus to become free/idle */
    for (timeOut = 0; timeOut < I2C_TIMEOUT; timeOut++)
    {
        if (I2C_IRQSTATUS_RAW_BB_FREE == (HWREG(baseI2c + I2C_IRQSTATUS) & I2C_IRQSTATUS_RAW_BB))        break;
    }

    if (timeOut == I2C_TIMEOUT)        return I2C_TIMEOUT_ERROR;

    /* configure the I2C bus as master for receiving mode */
    HWREG(baseI2c + I2C_CON) = I2C_CON_I2C_EN | I2C_CON_MST | I2C_CON_TRX_RCV | I2C_CON_STP | I2C_CON_STT;

    /* in THIS loop till we have TO read all the data or we have timed-out,
     * read the data from I2C data register and return
     */

    for (timeOut = 0; timeOut < I2C_TIMEOUT; timeOut++)
    {
        status = HWREG(baseI2c + I2C_IRQSTATUS);

        /* Check for NACK*/
        if (0 == (status & I2C_IRQSTATUS_RAW_NACK))
        {
            /*  ACK received. Now check for data ready */
            if (0 == (status & I2C_IRQSTATUS_RAW_ARDY))
            {
                /* check for RRDY for data availability */
                if (I2C_IRQSTATUS_RAW_RRDY == (status & I2C_IRQSTATUS_RAW_RRDY ))
                {
                    /* check if we have buffer space available */
                    if (bytesRead < bufLen)
                    {
                        /* data is available. Read it now and ACK */
                        *pDataPtr++ = (HWREG(baseI2c + I2C_DATA)) & I2C_DATA_DATA;
                        bytesRead++;
                    }

                    /* clear the RRDY bits */
                    HWREG(baseI2c + I2C_IRQSTATUS) = I2C_IRQSTATUS_RAW_RRDY;
                }
            }
            retVal = I2C_ErrorHandling(baseI2c);
            if(retVal != I2C_TRANSFER_SUCCESS)          return retVal;

            delay_ms(10);
        }
        else
        {
            /* clear the NACK bits */
            HWREG(baseI2c + I2C_IRQSTATUS) = (I2C_IRQSTATUS_RAW_NACK_CLEAR << I2C_IRQSTATUS_RAW_NACK_SHIFT);
            return I2C_NACK_RECEIVED;
        }
    }

    /* before returning, update the return counts too */
    if (NULL != pDataRead)        *pDataRead = bytesRead;

return I2C_TRANSFER_SUCCESS;
}

/** **************************************************************************
 * \n \brief Routine to write data from slave device the I2C - 0
 *
 * This routine initializes the I2C controller for writing to the slave
 * peripheral connected to the bus. This function takes the slave address
 * as a parameter along with the write buffer pointer and the length of buffer.
 * This function returns the number of bytes written into the output length pointer.
 *
 * busNum       [IN]        I2C Bus number
 * slaveAddr    [IN]        I2C Slave address to read from
 * buffer       [OUT]       Buffer pointer to copy data into
 * bufLen       [IN]        Length of the input buffer pointer
 * pDataRead    [OUT]       Place holder to return read number of bytes
 *
 * Return
 *       return SUCCESS for success  - Description
 *       return FAIL for error   - Description
 */
I2C_ERROR_CODE_Type I2CWrite
(
    uint8_t   busNum,
    uint16_t  slaveAddr,
    uint8_t   *buffer,
    uint8_t   bufLen,
    uint8_t   *dataWritten
)
{
    I2C_ERROR_CODE_Type retVal = I2C_TRANSFER_SUCCESS;
    uint16_t  status = 0;
    uint8_t   bytesWritten = 0;
    uint32_t  timeOut = I2C_TIMEOUT;
    uint32_t  baseI2c = 0;

    if ((NULL == buffer) ||  (0 == bufLen) || (NULL == dataWritten )) {
        return I2C_INVALID_PARAM;
    }

    /* Assign the I2C register base */
    baseI2c = I2C_GetBaseAddress(busNum);
    if(baseI2c == I2C_INVALID_PARAM)    return I2C_INVALID_PARAM;

    /* just to ensure the previous transactions flags are cleared */
    HWREG(baseI2c + I2C_IRQSTATUS ) = I2C_CNT_DCOUNT;
    delay_ms(1);

    /*  set the slave address */
    HWREG(baseI2c + I2C_SA) = (slaveAddr << 1) & I2C_SA_SA;
    delay_ms(1);
    ConsoleUtilsPrintf("\n Slave Addr:0x%x",HWREG(baseI2c + I2C_SA));

    /* set the count */
    HWREG(baseI2c + I2C_CNT) = bufLen;
    delay_ms(1);
    ConsoleUtilsPrintf("\n Buffer Length:0x%x",HWREG(baseI2c + I2C_CNT));

    /* Poll for the bus to become free/idle */
    for (timeOut = 0; timeOut < I2C_TIMEOUT; timeOut++)
    {
        if (I2C_IRQSTATUS_RAW_BB_FREE == (HWREG(baseI2c + I2C_IRQSTATUS) & I2C_IRQSTATUS_RAW_BB))        break;
    }

    /*********/

    if (timeOut == I2C_TIMEOUT)        return I2C_TIMEOUT_ERROR;

    /* configure the I2C bus as master for receiving mode */
    HWREG(baseI2c + I2C_CON) = I2C_CON_I2C_EN | I2C_CON_MST | I2C_CON_TRX_TRX | I2C_CON_STP;
//    delay_ms(1);
//    ConsoleUtilsPrintf("\n I2C Control:0x%x",HWREG(baseI2c + I2C_CON));

    /* Loop till we have written all the data or we have timed-out */
//    for (timeOut = 0; timeOut < I2C_TIMEOUT; timeOut++)
//    {
    HWREG(baseI2c + I2C_CON) |= I2C_CON_STT;
//    __delay_cycles(5000);
    ConsoleUtilsPrintf("\n CON:0x%x",HWREG(baseI2c + I2C_CON));
//    __delay_cycles(5000);
    while(1)
    {
        timeOut++;
        if(timeOut == I2C_TIMEOUT)      return I2C_TIMEOUT_ERROR;

        /* clear the AL bits */
//        HWREG(baseI2c + I2C_IRQSTATUS) = I2C_IRQSTATUS_RAW_AL_CLEAR;
        status = HWREG(baseI2c + I2C_IRQSTATUS);
//        __delay_cycles(5000);
        ConsoleUtilsPrintf("\n RAW Status:0x%x",HWREG(baseI2c + I2C_IRQSTATUS_RAW));
//        __delay_cycles(5000);
        ConsoleUtilsPrintf("\n Status:0x%x",status);

        /* Check for NACK*/
        if(!(status & I2C_IRQSTATUS_RAW_NACK))
        {
            /*  ACK received. Now check for data ready */
            if(!(status & I2C_IRQSTATUS_RAW_ARDY))
            {
                /* check for XRDY for data availability */
                if(status & I2C_IRQSTATUS_RAW_XRDY)
                {
                    ConsoleUtilsPrintf("\n Update Data.");
                    /* check if we have buffer space available */
                    if(bytesWritten < bufLen)
                    {
                        /* Write the data and ACK */
                        HWREG(baseI2c + I2C_DATA) = (*buffer++ & I2C_DATA_DATA);
                        delay_ms(1);
                        bytesWritten++;
                    }
                    /* check if we have buffer space available */

                    /* clear the XRDY bits */
                    HWREG(baseI2c + I2C_IRQSTATUS) = (I2C_IRQSTATUS_RAW_XRDY_CLEAR << I2C_IRQSTATUS_RAW_XRDY_SHIFT);
                    delay_ms(1);
                }
                else
                {
                    /* loop through to make another attempt */
                    ConsoleUtilsPrintf("\n XRDY Not Available|:0x%x",status);
//                    retVal = I2C_ErrorHandling(baseI2c);
                    if(retVal != I2C_TRANSFER_SUCCESS)
                        return I2C_INVALID_ERROR;
                }
            }
            else
            {
                ConsoleUtilsPrintf("\n Register Access Not Available:0x%x",status);
            }
            if (bytesWritten == bufLen)                delay_ms(I2C_TIMEOUT);

            retVal = I2C_ErrorHandling(baseI2c);
            if(retVal != I2C_TRANSFER_SUCCESS)          return retVal;

        }
        else
        {
//            retVal = FAIL;
            ConsoleUtilsPrintf("\n Received NACK");
            retVal = I2C_ErrorHandling(baseI2c);
            if(retVal != I2C_TRANSFER_SUCCESS)          return retVal;
//            /* clear the NACK bits */
//            HWREG(baseI2c + I2C_IRQSTATUS) = (I2C_IRQSTATUS_RAW_NACK_CLEAR << I2C_IRQSTATUS_RAW_NACK_SHIFT);
//            return I2C_NACK_RECEIVED;
        }
    }

    /* before returning, update the return counts too */
    if (NULL != dataWritten){
        *dataWritten = bytesWritten;
        ConsoleUtilsPrintf("\n Data Written:%d,%d",*dataWritten,bytesWritten);
    }

return I2C_TRANSFER_SUCCESS;
}

#define I2C_READ        0x21
#define I2C_WRITE       0x21

#define REG_BIT_MASK                   (0x1F)
#define REG_IDX_SHIFT                  (0x05)
void init_i2c1(void)
{
    // Need to Enable Clock & I2C Peripheral
    I2CInit(I2C1_BUS);

    HWREG(SOC_I2C_1_REGS + I2C_IRQENABLE_SET) = I2C_IRQENABLE_SET_AL_IE | I2C_IRQENABLE_SET_NACK_IE |
            I2C_IRQENABLE_SET_ROVR | I2C_IRQENABLE_SET_RRDY_IE | I2C_IRQENABLE_SET_ARDY_IE |
            I2C_IRQENABLE_SET_XRDY_IE | I2C_IRQENABLE_SET_XDR_IE | I2C_IRQENABLE_SET_RDR_IE;
    __delay_cycles(5000);
    ConsoleUtilsPrintf("\n Interrupt Set:0x%x",HWREG(SOC_I2C_1_REGS + I2C_IRQENABLE_SET));
}

void read_productid(void)
{
uint8_t product_command1[2] = {0x36,0x7C};
uint8_t soft_reset_cmd[2] = {0x00,0x06};
uint8_t product_command2[2] = {0xE1,0x02};
uint8_t return_product_id[20];
uint8_t read_bytes=0,write_bytes=0;
int16_t i;
I2C_ERROR_CODE_Type errorCode;

    memset(return_product_id,0x00,sizeof return_product_id);

    errorCode = I2CWrite(I2C1_BUS,I2C_WRITE,soft_reset_cmd,2,&write_bytes);
    if(errorCode != I2C_TRANSFER_SUCCESS)  ConsoleUtilsPrintf("\n Error writing data ,bytes:%d | error:%d",write_bytes,errorCode);
    else
    {
        ConsoleUtilsPrintf("\n Writing Command Code 1.");
        errorCode = I2CWrite(I2C1_BUS,I2C_WRITE,product_command1,2,&write_bytes);
        if(errorCode != I2C_TRANSFER_SUCCESS)  ConsoleUtilsPrintf("\n Error writing data ,bytes:%d | error:%d",write_bytes,errorCode);
        else {
            delay_ms(2);
            ConsoleUtilsPrintf("\n Writing Command Code 2. ,Bytes:%d",write_bytes);
            errorCode = I2CWrite(I2C1_BUS,I2C_WRITE,product_command2,2,&write_bytes);
            if(errorCode != I2C_TRANSFER_SUCCESS)  ConsoleUtilsPrintf("\n Error writing data ,bytes:%d | error:%d",write_bytes,errorCode);
            else {
                delay_ms(2);
                ConsoleUtilsPrintf("\n Reading Product Data. ,Bytes:%d",write_bytes);
                errorCode = I2CRead(I2C1_BUS,I2C_READ,return_product_id,18,&read_bytes);
                if(errorCode != I2C_TRANSFER_SUCCESS)  ConsoleUtilsPrintf("\n Error Reading data ,bytes:%d | error:%d",read_bytes,errorCode);
                else {
                    ConsoleUtilsPrintf("\n Reading Successful. ,Bytes:%d",read_bytes);
                }
            }
        }

        if(errorCode == I2C_TRANSFER_SUCCESS){
            // Print Product Id
            ConsoleUtilsPrintf("\n Product Id.");
            for(i=0;i<20;i++)
            {
                ConsoleUtilsPrintf("\nBYTE[%d]:0x%02x",i,return_product_id[i]);
            }
        }
    }
}


void read_i2c_register(uint8_t i2cBus)
{
uint32_t i2cAddr=0,clkAddr=0;

    if(i2cBus == 0)
    {
        i2cAddr = SOC_I2C_0_REGS;
        clkAddr = CM_PER_I2C1_CLKCTRL;
    }
    else
    {
        i2cAddr = SOC_I2C_1_REGS;
        clkAddr = CM_PER_I2C2_CLKCTRL;
    }

    ConsoleUtilsPrintf("\n*****************************************************");
    ConsoleUtilsPrintf("\n************* I2C Bus: %d at 0x%x **************",i2cBus,i2cAddr);
    ConsoleUtilsPrintf("\n*****************************************************");
    ConsoleUtilsPrintf("\n CM_PER_I2C_CLKCTRL[0x%x]:0x%x",clkAddr,HWREG(SOC_PRCM_REGS + clkAddr));
    ConsoleUtilsPrintf("\n I2C_REVNB_LO:0x%x",HWREG(i2cAddr + I2C_REVNB_LO));
    ConsoleUtilsPrintf("\n I2C_REVNB_HI:0x%x",HWREG(i2cAddr + I2C_REVNB_HI));
    ConsoleUtilsPrintf("\n I2C_SYSC:0x%x",HWREG(i2cAddr + I2C_SYSC));
    ConsoleUtilsPrintf("\n I2C_EOI:0x%x",HWREG(i2cAddr + I2C_EOI));
    ConsoleUtilsPrintf("\n I2C_IRQSTATUS_RAW:0x%x",HWREG(i2cAddr + I2C_IRQSTATUS_RAW));
    ConsoleUtilsPrintf("\n I2C_IRQSTATUS:0x%x",HWREG(i2cAddr + I2C_IRQSTATUS));
    ConsoleUtilsPrintf("\n I2C_IRQENABLE_SET:0x%x",HWREG(i2cAddr + I2C_IRQENABLE_SET));
    ConsoleUtilsPrintf("\n I2C_IRQENABLE_CLR:0x%x",HWREG(i2cAddr + I2C_IRQENABLE_CLR));
    ConsoleUtilsPrintf("\n I2C_WE:0x%x",HWREG(i2cAddr + I2C_WE));
    ConsoleUtilsPrintf("\n I2C_DMARXENABLE_SET:0x%x",HWREG(i2cAddr + I2C_DMARXENABLE_SET));
    ConsoleUtilsPrintf("\n I2C_DMATXENABLE_SET:0x%x",HWREG(i2cAddr + I2C_DMATXENABLE_SET));
    ConsoleUtilsPrintf("\n I2C_DMARXENABLE_CLR:0x%x",HWREG(i2cAddr + I2C_DMARXENABLE_CLR));
    ConsoleUtilsPrintf("\n I2C_DMATXENABLE_CLR:0x%x",HWREG(i2cAddr + I2C_DMATXENABLE_CLR));
    ConsoleUtilsPrintf("\n I2C_DMARXWAKE_EN:0x%x",HWREG(i2cAddr + I2C_DMARXWAKE_EN));
    ConsoleUtilsPrintf("\n I2C_DMATXWAKE_EN:0x%x",HWREG(i2cAddr + I2C_DMATXWAKE_EN));
    ConsoleUtilsPrintf("\n I2C_SYSS:0x%x",HWREG(i2cAddr + I2C_SYSS));
    ConsoleUtilsPrintf("\n I2C_BUF:0x%x",HWREG(i2cAddr + I2C_BUF));
    ConsoleUtilsPrintf("\n I2C_CNT:0x%x",HWREG(i2cAddr + I2C_CNT));
    ConsoleUtilsPrintf("\n I2C_DATA:0x%x",HWREG(i2cAddr + I2C_DATA));
    ConsoleUtilsPrintf("\n I2C_CON:0x%x",HWREG(i2cAddr + I2C_CON));
    ConsoleUtilsPrintf("\n I2C_OA:0x%x",HWREG(i2cAddr + I2C_OA));
    ConsoleUtilsPrintf("\n I2C_SA:0x%x",HWREG(i2cAddr + I2C_SA));
    ConsoleUtilsPrintf("\n I2C_PSC:0x%x",HWREG(i2cAddr + I2C_PSC));
    ConsoleUtilsPrintf("\n I2C_SCLL:0x%x",HWREG(i2cAddr + I2C_SCLL));
    ConsoleUtilsPrintf("\n I2C_SCLH:0x%x",HWREG(i2cAddr + I2C_SCLH));
    ConsoleUtilsPrintf("\n I2C_SYSTEST:0x%x",HWREG(i2cAddr + I2C_SYSTEST));
    ConsoleUtilsPrintf("\n I2C_BUFSTAT:0x%x",HWREG(i2cAddr + I2C_BUFSTAT));
    ConsoleUtilsPrintf("\n I2C_ACTOA:0x%x",HWREG(i2cAddr + I2C_ACTOA));
    ConsoleUtilsPrintf("\n I2C_SBLOCK:0x%x",HWREG(i2cAddr + I2C_SBLOCK));
    ConsoleUtilsPrintf("\n*****************************************************");
}

CC2640R2F: CC2640R2F: Example project for Directed Advertiment

$
0
0

Part Number:CC2640R2F

Hi all,

Stack used : 3.1.1

is the any Example project available regarding how do enable directed advertisement ?

thanks!


7.4 V Li- ion battery charger IC with charging control

$
0
0

Hello,

         I need charging IC with charging control for 7.4 V Li-ion battery. I have searched on TI website but to no avail, as I found battery charging ICs for 4.2 V Li-ion batteries. 

         Can anyone suggest any components or method by which I can achieve charging circuit of 7.4 V Li-ion battery

Regards,

Omkar

CC1310: ESR specification suitability for Murata XRCGB24M000FBP12R0 24MHz crystal

$
0
0

Part Number:CC1310

TI Friends & Family,

We have a group that was looking to change the crystal used (the 24MHz one) and are interested in the Murata XRCGB24M000FBP12R0 which is listed on the list of suitable substitutes for the CC13x0. However this crystal has an 80ohm ESR which is above the recommended level:

 Can you provide clarification on this parameter and the suitability of the Murata part?

 Thank you,

CY

TMS570LC4357: TMS570LC4357 - ePWM1 and GIOA0 and GIOA1

$
0
0

Part Number:TMS570LC4357

Hello,

i need your help to resolve an very inexplicable issue.

I'm using GIOA0 and GIOA1 as external interrupt pins for long time.

Along with it i'm using ePWM1A to generate output signal - PERIOD - Turn On, ZERO - Turn off - frequency is 12.5 kHz (40 uS).

I decied to use ePWM1 interrupt also, but when i enable it, processor is overloaded by ePWM1 interrupts.

When I disable GIOA0 and GIOA1 interrupts, the ePWM1 interrupt is generated properly.

Do you know about some corelation which could cause this unexpected behaviour?

Thank you

Jan

CC2541: OAD from Android Application

$
0
0

Part Number:CC2541

I made device based on CC2541 and ble_sdk_1.4.2.2 (OAD is enabled).
Device work fine.
OAD feature works fine when i use windows application "BLE device monitor" for upload firmware . I can upload any image( A or B image);

Currently i try to implement ability for updating firmware through OAD from android.
My android application is based on SensorTag sample. I had just disabled characteristic for setting timeout because this feature is not implemented in my firmware.

All my attempts to upgrade firmware through android application failed.

I've noticed that sometimes BluetoothGatt.writeCharacteristic(BluetoothGattCharacteristic characteristic) ; (android app) return false;

I suppose that it is cause of fail.

Could someone explain me what is wrong? Why windows app work fine and android app not.

TDA2EVM5777: Omnivision Sensors with Vision SDK

$
0
0

Part Number:TDA2EVM5777

Hi,

We are having following queries for sensors/lenses with Vision SDK:

Query 1:

We understand from that Vision board only one sensor can be connected to TDA2x.

We plan to use the Omnivision sensors / lenses to connect to Vision board. (Not using multides)

Can you please confirm that capture link from VisionSDK would be able to capture video frame from camera connected to directly to VisionSDK ?

Query 2:

Has TI used IR camera for any of the test cases ?  Do you see any compatibility issues in using IR camera sensor with VisionSDK, capture link ?

Please provide your views.

Thanks,

Abhishek

CSD18534Q5A: Reflow Profile

IWR1443BOOST: can I get IQ signal from IWR1443BOOST directly?


MSP432P401R: GPIO Interrupt not working with SDFatFS routine

$
0
0

Part Number:MSP432P401R

Hi all,

I am building a project wherein my aim is to log data in a file in an SD card whenever a GPIO interrupt occurs.

I borrowed the SD card code from the fatsd example project from TIREX. I modified the code to suit my needs and on its own it is working well.

I also have a GPIO interrupt associated to P1.4 (push button switch) upon pressing which, the red LED (P1.0) toggles. This code also on its own is working well.

However when I have both of these codes active in the program, the interrupt part of the code stops working. I tried to step through the APIs used in the writing of data into SD card but they just seem too complicated. What could be the reason for this?

Also what is the best and most efficient way for me to write data into an SD card? Is accessing it through TI's APIs the best way to go forward?

TMS320F28335: XCLKOUT stabilize time

$
0
0

Part Number:TMS320F28335

Hi there,

My questions is with regards to the XCLKOUT signal when using a 150MHz external oscillator

1. Is the  XCLKOUT signal continuous once stable at 150MHz.

2. How long does it take  XCLKOUT signal to stabilise to 150MHz upon power up as I can see from the data sheet it goes through various transitions. The datasheet is not clear about this. Can you please explain in detail.

3. Can I use  XCLKOUT signal to drive external logic  like (DPRAM IP) inside a FPGA device without locking the logic out due to the various transitions of clock at power up.

Best regards,

Dhaivat

CCS: CCS/MSP430FR5969: CCS/MSP430FR5972 + ADC + Timers

$
0
0

Tool/software: Code Composer Studio

Hi all!

Unfortunately, it is difficult for me to switch from Atmel to MSP430FR5972 ...
I'm asking for help

I need to solve this problem:
1) The ADC should "round-robin" the multiplexer by 1--2-3-4 ...- 8 inputs and, bypassing the processor, immediately use direct memory access. Write values ​​from each channel to separate memory locations. I need 12 bits.
How to program the ADC to this mode of operation?
How to make records bypassing the processor immediately in memory? that is: without calling "interruption" on the readiness of the data in the ADC, immediately write through the controller of direct access to the memory (DMA controller)? Is this possible?

Timers should be powered from an internal clock source, the processor clock speed = 8MHz.

2) The first timer is 16 bits, triggered by an interrupt "overflow".
in interrupt processing is my program. Triggering 150 times per second, while no external pins of the chip can not be touched.

3) Second timer 16 bits, triggered by interrupt "overflow".
in interrupt processing is my program. Trigger every 0.5 sec, but do not touch any external pins of the chip. Can I use the "real-time timer" (RTC) as a timer to work on the built-in clock generator (8MHz)?

4) The third timer is 16 bits, it does not cause any interruptions. Triggering 30000 times per second, It simply works from the minimum to the maximum of the values ​​forming the PWM output (one pin of the chip). The values ​​of the counter "Timer 3" I myself put out of my program "Timer 1", writing data directly to the counter "Timer 3.

5) to output information from my program, I will use HD44780 LCS, so I need to select the ports of the MCP430 so that I do not interfere with the operation of the ADC and Timers. (See above).

I have a test card for the "initial set" based on MSP430FR5969, I want to check it out first how this will work.
The examples I saw do not give me the opportunity to see the whole picture of the whole work. :(
I ask for your help with the initial configuration of the MCP430 for this my task.


CC2640: Device stops advertising after successful OAD.

$
0
0

Part Number:CC2640

Hi,

I have a CC2640 custom board.

I have followed on-chip out of box demo described in OAD user's guide.

I have created the merged file by running merge.bat script and uploaded the merged image into the board using Flash Programmer.

Then I created a hex file for simple_peripheral_cc2650lp_app and used oad_image_tool to create a bin file.

The script output is as follows:

******************************************************************************************
Texas Instruments OAD Image Tool
Version: 1.0
******************************************************************************************

OAD Type: onchip
Img Type: APP
Input file(s): simple_peripheral_cc2650lp_app.hex
Output Hex file: None
Output Bin file: test1.bin

Layout of concatenated input files, per flash sector, before applying --range.

 00 | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 | 11 | 12 | 13 | 14 | 15
---- ---- ---- ---- ---- ---- ---- ---- ---- XXXX XXXX XXXX XXXX XXXX XXXX XXXX
---- ---- ---- ---- ---- ---- ---- ---- ---- XXXX XXXX XXXX XXXX XXXX XXXX XXXX
---- ---- ---- ---- ---- ---- ---- ---- ---- XXXX XXXX XXXX XXXX XXXX XXXX XXXX
---- ---- ---- ---- ---- ---- ---- ---- ---- xXXX XXXX XXXX XXXX XXXX XXXX XXXX
 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31
XXXX XX-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
XXXX XX-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
XXXX XX-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
XXXX XX.- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----

  Legend: `X` 100% full, `x` >50% full, `.` <50% full, `-` empty, `F` all 0xFF,
  `0` all 0x00.
******************************************************************************************
Runtime Output:

Last address was 0x11843. Expanded to 0x11850 to be divisible by OAD block size
Expanded address range. Placed metadata at 0x00009000

The script has calculated the 16 Byte OAD Metadata vector below

Bytes: | 0 - 2  |  2 - 4   | 4 - 6  | 6 - 8  |     8-12    | 12 - 14 |   15    |  16  |
Desc : |  CRC   | CRC-SHDW | imgVer | imgLen |     usrId   | imgAddr | imgType | stat |
---------------------------------------------------------------------------------------
Data : | 0x955A |  0xFFFF  |     1  |   8724 | 45:45:45:45 |   2400  |   01    |  FF  |
******************************************************************************************

Header As It Is:
OrderedDict([('crc', 38234), ('crcShdw', 65535), ('imgVer', 1), ('imgLen', 8724), ('usrId', '45:45:45:45'), ('imgAddr', 9216), ('imgType', 1), ('status', 255)])
Writing to:
 test1.bin
******************************************************************************************
Success
******************************************************************************************


Then I tried to upload the bin file over the air using BTool and CC2540 USB Dongle... When process completed, btool showed OAD Successful and my custom device automatically disconnected..

But then it stopped advertising. Even after resetting the device.

WL1831MOD: Changelog / Release notes for wl18xx-fw

$
0
0

Part Number:WL1831MOD

I'm using a wl1831 chip together with the wl18xx_fw (v8.9.0.0.70). Looking at the commits of the git repo I can see that there are quite a few newer releases than the one I'm using but I can't seem to find the release notes for them. Where do you publish these?

Commit log: http://git.ti.com/wilink8-wlan/wl18xx_fw/commits/master

// Måns

Viewing all 262198 articles
Browse latest View live