rom_i2c_writeReg_Mask会导致系统崩溃???

zxl965210
Posts: 5
Joined: Thu Mar 17, 2016 3:03 pm

rom_i2c_writeReg_Mask会导致系统崩溃???

Postby zxl965210 » Fri Mar 25, 2016 6:38 pm

定义如下,调用rom_i2c_writeReg_Mask后连接wifi,会导致系统崩溃问题,sdk版本v1.5.0

Code: Select all

#define i2c_bbpll                           0x67
#define i2c_bbpll_en_audio_clock_out           4
#define i2c_bbpll_en_audio_clock_out_msb       7
#define i2c_bbpll_en_audio_clock_out_lsb       7
#define i2c_bbpll_hostid                      4
rom_i2c_writeReg_Mask(i2c_bbpll, i2c_bbpll_hostid, i2c_bbpll_en_audio_clock_out, i2c_bbpll_en_audio_clock_out_msb, i2c_bbpll_en_audio_clock_out_lsb, 1);

zxl965210
Posts: 5
Joined: Thu Mar 17, 2016 3:03 pm

Re: rom_i2c_writeReg_Mask会导致系统崩溃???

Postby zxl965210 » Fri Mar 25, 2016 10:38 pm

找到异常原因,只有工作在station模式下会崩溃,AP模式没有问题,AP+STATION也不会有问题,期望尽快修复啊,应该算是BUG了吧,,,,

ESP_Faye
Posts: 1646
Joined: Mon Oct 27, 2014 11:08 am

Re: rom_i2c_writeReg_Mask会导致系统崩溃???

Postby ESP_Faye » Wed Mar 30, 2016 10:06 am

您好,

1.请问,您是否直接在中断函数里调用的 gen_carrier_clk?
2.请使用以下的函数,代替上面的函数试一下,
在 ir_tx_init() 里调用 BF_i2c_writeReg_Mask(0x67, 4, 4 , 7, 7, 1);

Code: Select all

#define I2C_BASE                            0x60000D00
#define I2S_BCK_DIV_NUM       0x0000003F
#define I2S_BCK_DIV_NUM_S       22
#define I2S_CLKM_DIV_NUM       0x0000003F
#define I2S_CLKM_DIV_NUM_S    16
#define I2S_BITS_MOD          0x0000000F
#define I2S_BITS_MOD_S          12
#define I2SCONF               (DR_REG_I2S_BASE + 0x0008)
#define DR_REG_I2S_BASE       (0x60000e00)

#define U32 uint32
#define i2c_bbpll                           0x67
#define i2c_bbpll_en_audio_clock_out                  4
#define i2c_bbpll_en_audio_clock_out_msb       7
#define i2c_bbpll_en_audio_clock_out_lsb       7
#define i2c_bbpll_hostid                      4

void ir_tx_carrier_clr()
{
   //PIN_FUNC_SELECT(IR_GPIO_OUT_MUX, IR_GPIO_OUT_FUNC);
   //GPIO_OUTPUT_SET(IR_GPIO_OUT_NUM, 1);
   WRITE_PERI_REG(0x60000e08, READ_PERI_REG(0x60000e08) & 0xfffffdff | (0x0<<8) ) ; //i2s clk stop
}



u8 BF_i2c_readReg(u8 block,u8 host_id,u8 reg_add)
{
    u32 mst_ctrl_addr = (0x60000d00 + host_id*4);
    WRITE_PERI_REG(mst_ctrl_addr, (0<<24)|(0<<16)|(reg_add<<8)|block ) ;//
    while(GET_PERI_REG_BITS(mst_ctrl_addr,25,25)!=0){};
    return(READ_PERI_REG(mst_ctrl_addr)>>16)&0xff;
    return ;
}
u8 BF_i2c_writeReg(u8 block,u8 host_id,u8 reg_add, u8 pData)
{
    u32 mst_ctrl_addr = (0x60000d00 + host_id*4);
    WRITE_PERI_REG(mst_ctrl_addr, (1<<24)|(pData<<16)|(reg_add<<8)|block ) ;//
    while(GET_PERI_REG_BITS(mst_ctrl_addr,25,25)!=0){};
    return ;
}
void BF_i2c_writeReg_Mask(u8 block,u8 host_id,u8 reg_add, u8 Msb, u8 Lsb,u8 indata)
{
        BF_i2c_writeReg
        (
            block, host_id,reg_add,
            BF_i2c_readReg(block, host_id, reg_add)&
            (~(((1<<(Msb-Lsb+1))-1)<<Lsb)) |
            (indata<<Lsb)
        );

void gen_carrier_clk()
{
       
   WRITE_PERI_REG(I2SCONF,  READ_PERI_REG(I2SCONF) & 0xf0000fff|
                       ( (( 62&I2S_BCK_DIV_NUM )<<I2S_BCK_DIV_NUM_S)| 
                       ((2&I2S_CLKM_DIV_NUM)<<I2S_CLKM_DIV_NUM_S)|   
                       ((1&I2S_BITS_MOD  )   <<  I2S_BITS_MOD_S )  )  );
   WRITE_PERI_REG(IR_NEC_TX_IO_MUX, (READ_PERI_REG(IR_NEC_TX_IO_MUX)&0xfffffe0f)| (0x1<<4) );
   WRITE_PERI_REG(0x60000e08, READ_PERI_REG(0x60000e08) & 0xfffffdff | (0x2<<8) ) ;//i2s rx  start
}

zxl965210
Posts: 5
Joined: Thu Mar 17, 2016 3:03 pm

Re: rom_i2c_writeReg_Mask会导致系统崩溃???

Postby zxl965210 » Sun Apr 17, 2016 3:26 pm

Espressif_Faye wrote:您好,

1.请问,您是否直接在中断函数里调用的 gen_carrier_clk?
2.请使用以下的函数,代替上面的函数试一下,
在 ir_tx_init() 里调用 BF_i2c_writeReg_Mask(0x67, 4, 4 , 7, 7, 1);

Code: Select all

#define I2C_BASE                            0x60000D00
#define I2S_BCK_DIV_NUM       0x0000003F
#define I2S_BCK_DIV_NUM_S       22
#define I2S_CLKM_DIV_NUM       0x0000003F
#define I2S_CLKM_DIV_NUM_S    16
#define I2S_BITS_MOD          0x0000000F
#define I2S_BITS_MOD_S          12
#define I2SCONF               (DR_REG_I2S_BASE + 0x0008)
#define DR_REG_I2S_BASE       (0x60000e00)

#define U32 uint32
#define i2c_bbpll                           0x67
#define i2c_bbpll_en_audio_clock_out                  4
#define i2c_bbpll_en_audio_clock_out_msb       7
#define i2c_bbpll_en_audio_clock_out_lsb       7
#define i2c_bbpll_hostid                      4

void ir_tx_carrier_clr()
{
   //PIN_FUNC_SELECT(IR_GPIO_OUT_MUX, IR_GPIO_OUT_FUNC);
   //GPIO_OUTPUT_SET(IR_GPIO_OUT_NUM, 1);
   WRITE_PERI_REG(0x60000e08, READ_PERI_REG(0x60000e08) & 0xfffffdff | (0x0<<8) ) ; //i2s clk stop
}



u8 BF_i2c_readReg(u8 block,u8 host_id,u8 reg_add)
{
    u32 mst_ctrl_addr = (0x60000d00 + host_id*4);
    WRITE_PERI_REG(mst_ctrl_addr, (0<<24)|(0<<16)|(reg_add<<8)|block ) ;//
    while(GET_PERI_REG_BITS(mst_ctrl_addr,25,25)!=0){};
    return(READ_PERI_REG(mst_ctrl_addr)>>16)&0xff;
    return ;
}
u8 BF_i2c_writeReg(u8 block,u8 host_id,u8 reg_add, u8 pData)
{
    u32 mst_ctrl_addr = (0x60000d00 + host_id*4);
    WRITE_PERI_REG(mst_ctrl_addr, (1<<24)|(pData<<16)|(reg_add<<8)|block ) ;//
    while(GET_PERI_REG_BITS(mst_ctrl_addr,25,25)!=0){};
    return ;
}
void BF_i2c_writeReg_Mask(u8 block,u8 host_id,u8 reg_add, u8 Msb, u8 Lsb,u8 indata)
{
        BF_i2c_writeReg
        (
            block, host_id,reg_add,
            BF_i2c_readReg(block, host_id, reg_add)&
            (~(((1<<(Msb-Lsb+1))-1)<<Lsb)) |
            (indata<<Lsb)
        );

void gen_carrier_clk()
{
       
   WRITE_PERI_REG(I2SCONF,  READ_PERI_REG(I2SCONF) & 0xf0000fff|
                       ( (( 62&I2S_BCK_DIV_NUM )<<I2S_BCK_DIV_NUM_S)| 
                       ((2&I2S_CLKM_DIV_NUM)<<I2S_CLKM_DIV_NUM_S)|   
                       ((1&I2S_BITS_MOD  )   <<  I2S_BITS_MOD_S )  )  );
   WRITE_PERI_REG(IR_NEC_TX_IO_MUX, (READ_PERI_REG(IR_NEC_TX_IO_MUX)&0xfffffe0f)| (0x1<<4) );
   WRITE_PERI_REG(0x60000e08, READ_PERI_REG(0x60000e08) & 0xfffffdff | (0x2<<8) ) ;//i2s rx  start
}




你好,将rom_i2c_writeReg_Mask放进初始化函数后问题已经解决,红外发射基于38k载波,提供的示例占空比为1/2,能否提供一个调节频率和占空比的函数,可以供开发者自定义频率和占空比。

ESP_Faye
Posts: 1646
Joined: Mon Oct 27, 2014 11:08 am

Re: rom_i2c_writeReg_Mask会导致系统崩溃???

Postby ESP_Faye » Tue Apr 19, 2016 2:47 pm

您好,

麻烦发邮件至我们的技术支持邮箱 feedback@espressif.com,以获得更多的技术帮助。

感谢您对 ESP8266 的关注!

Who is online

Users browsing this forum: No registered users and 17 guests