This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC1310: 调用sleep(PACKET_INTERVAL);后管脚保持高电平需要怎么配置

Part Number: CC1310

1. rfPacketTx工程上添加IIC功能,在调用sleep(PACKET_INTERVAL);后测得DIO4和DIO5的管脚为0.63V,不是高电平。

2. 想在调用sleep(PACKET_INTERVAL);后DIO4和DIO5的管脚保持高电平需要怎么配置?

3. 相关代码:

I2C_init();
// initialize optional I2C bus parameters
I2C_Params params;
I2C_Params_init(&params);
params.bitRate = I2C_100kHz;
// Open I2C bus for usage
I2C_Handle i2cHandle = I2C_open(0, &params);
// Initialize slave address of transaction
I2C_Transaction transaction = {0};
transaction.slaveAddress = 0x44;

uint8_t iic_write_data[] = {0xCC,0x44};
uint8_t iic_read_data[3];

// Write to I2C slave device
transaction.writeBuf = iic_write_data;
transaction.writeCount = sizeof(iic_write_data);
transaction.readCount = 0;
I2C_transfer(i2cHandle, &transaction);

usleep(10000);

// Read from I2C slave device
transaction.readBuf = iic_read_data;
transaction.readCount = sizeof(iic_read_data);
transaction.writeCount = 0;
I2C_transfer(i2cHandle, &transaction);

//。。。

sleep(PACKET_INTERVAL);

  • 您好,

    感谢您的提问 ,这边需要更多的信息来更好帮您解决问题。

    请问您使用的SDK版本是多少?rfPacketTx工程是RTOS的还是NO-RTOS的?

    期待您的回复。

  • SDK版本是4.20

    rfPacketTx工程是NO-RTOS

  • 您好,

    我测试了一下 rfPacketTX 示例与您应该相同的配置下(您提供的部分代码),并没有得到和您相同的结果,DIO4 和 DIO5 在休眠前都是3.3V。

    您可以尝试在休眠前关闭 I2C driver,接着再在 BoardGpioInitTable[ ] 中配置 DIO4 和 DIO5 为高电平,如下:

    /*
     *  =============================== PIN ===============================
     */
    #include <ti/drivers/PIN.h>
    #include <ti/drivers/pin/PINCC26XX.h>
    
    const PIN_Config BoardGpioInitTable[] = {
    
        CC1310_LAUNCHXL_PIN_RLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,       /* LED initially off          */
        CC1310_LAUNCHXL_PIN_GLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,       /* LED initially off          */
        CC1310_LAUNCHXL_PIN_BTN1 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS,          /* Button is active low       */
        CC1310_LAUNCHXL_PIN_BTN2 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS,          /* Button is active low       */
        CC1310_LAUNCHXL_SPI_FLASH_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN,  /* External flash chip select */
        CC1310_LAUNCHXL_UART_RX | PIN_INPUT_EN | PIN_PULLDOWN,                                              /* UART RX via debugger back channel */
        CC1310_LAUNCHXL_UART_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,                         /* UART TX via debugger back channel */
        CC1310_LAUNCHXL_SPI0_MOSI | PIN_INPUT_EN | PIN_PULLDOWN,                                            /* SPI master out - slave in */
        CC1310_LAUNCHXL_SPI0_MISO | PIN_INPUT_EN | PIN_PULLDOWN,                                            /* SPI master in - slave out */
        CC1310_LAUNCHXL_SPI0_CLK | PIN_INPUT_EN | PIN_PULLDOWN,                                             /* SPI clock */
    
        CC1310_LAUNCHXL_I2C0_SCL0 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL,
        CC1310_LAUNCHXL_I2C0_SDA0 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL,
    
        PIN_TERMINATE
    };
    希望可以帮助到您。

  • CC1310_LAUNCHXL_I2C0_SCL0 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL,
    CC1310_LAUNCHXL_I2C0_SDA0 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL,

    代码存在潜在问题,当有其他设备共用iic总线,会受到影响!

  • 您好,

    不好意思我们对这个有一些困惑,这边有些问题想要咨询您。

    您说想要保持在休眠时DIO4和DIO5的管脚为高电平,那您这个需求是不是本身就会有影响其他设备共用iic总线的潜在问题存在?

    希望您指出,是不是我们在理解问题需求上有偏差。

  • 是发现休眠时,低电平会漏电。所以希望休眠时能高电平,你的解决方法也是可以的,设置为上拉输入会不会更好?

  • 您好,

    设置为上拉输入会不会更好

    您说的没错。

  • 上拉输入配置,休眠还是低电平

    const PIN_Config BoardGpioInitTable[] = {

    CC1310_LAUNCHXL_PIN_RLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */
    CC1310_LAUNCHXL_PIN_GLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */
    CC1310_LAUNCHXL_PIN_BTN1 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
    CC1310_LAUNCHXL_PIN_BTN2 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
    CC1310_LAUNCHXL_SPI_FLASH_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */
    CC1310_LAUNCHXL_UART_RX | PIN_INPUT_EN | PIN_PULLDOWN, /* UART RX via debugger back channel */
    CC1310_LAUNCHXL_UART_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL, /* UART TX via debugger back channel */
    CC1310_LAUNCHXL_SPI0_MOSI | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master out - slave in */
    CC1310_LAUNCHXL_SPI0_MISO | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master in - slave out */
    CC1310_LAUNCHXL_SPI0_CLK | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI clock */

    CC1310_LAUNCHXL_I2C0_SCL0 | PIN_INPUT_EN | PIN_PULLUP,
    CC1310_LAUNCHXL_I2C0_SDA0 | PIN_INPUT_EN | PIN_PULLUP,

    PIN_TERMINATE
    };

  • 您好,

    您是在一条I2C总线上接了多个外设吗?当睡眠的时候您是怎么配置这些外设的?

  • 休眠时,把外设取下,直接用万用表测得是低的。

  • 您好,

    不是测量的时候,是实际使用的时候您的i2c设备是如何配置的?

  • 就是下面配置

    const PIN_Config BoardGpioInitTable[] = {

    CC1310_LAUNCHXL_PIN_RLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */
    CC1310_LAUNCHXL_PIN_GLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */
    CC1310_LAUNCHXL_PIN_BTN1 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
    CC1310_LAUNCHXL_PIN_BTN2 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
    CC1310_LAUNCHXL_SPI_FLASH_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */
    CC1310_LAUNCHXL_UART_RX | PIN_INPUT_EN | PIN_PULLDOWN, /* UART RX via debugger back channel */
    CC1310_LAUNCHXL_UART_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL, /* UART TX via debugger back channel */
    CC1310_LAUNCHXL_SPI0_MOSI | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master out - slave in */
    CC1310_LAUNCHXL_SPI0_MISO | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master in - slave out */
    CC1310_LAUNCHXL_SPI0_CLK | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI clock */

    CC1310_LAUNCHXL_I2C0_SCL0 | PIN_INPUT_EN | PIN_PULLUP,
    CC1310_LAUNCHXL_I2C0_SDA0 | PIN_INPUT_EN | PIN_PULLUP,

    PIN_TERMINATE
    };

    打开iic读取传器数据就关闭,

    1. 测试功耗发现有漏电,接上逻辑分析仪就不漏电,通过万用表知道iic的管脚是浮空状态,不是0V也不是vcc电压,是中间状态

  • 您好,

    所以您是通过I2C来读取总线上接了着的传感器的数据,读完就关闭I2C。且在关闭后设备休眠且要保持I2C的管脚为高电平。

    这么总结您的目的对吗?

    测试功耗发现有漏电,接上逻辑分析仪就不漏电,通过万用表知道iic的管脚是浮空状态,不是0V也不是vcc电压,是中间状态

    这个部分我还需要点时间查看测试一下。

  • 是的,关闭设备后休眠且要保持I2C的管脚为高电平,是为了防止漏电。

  • 您好,

    感谢您的跟进,我们还需要点时间研究该问题,有结论及时联系您。