Calling sendto() API in isr causes InstrFetchProhibited.
Posted: Thu Jan 12, 2017 2:40 am
Hi!
Here is my code!
I call API in i2s_isr.Then Exception happens.Log is:
---------------------------------------------------------------------------------------------------------------------------------------
Guru Meditation Error of type InstrFetchProhibited occurred on core 0. Exception was unhandled.
Register dump:
PC : 0x00000000 PS : 0x00050133 A0 : 0x00000000 A1 : 0x3ffbfb80
A2 : 0x3ffbfbe0 A3 : 0x3ffbd754 A4 : 0xffffffff A5 : 0x00000000
A6 : 0x00000000 A7 : 0x00000000 A8 : 0x00000000 A9 : 0xffffffff
A10 : 0x3ffbfbe0 A11 : 0x00000000 A12 : 0x00000000 A13 : 0xffffffff
A14 : 0x00000000 A15 : 0x00000000 SAR : 0x00000000 EXCCAUSE: 0x00000014
EXCVADDR: 0x00000000 LBEG : 0x40109aec LEND : 0x3ffbfc64 LCOUNT : 0x3ffbfc10
Backtrace: 0x00000000:0x3ffbfb80 0x00000000:0x3ffbfba0 0x400ed19c:0x3ffbfbe0 0x400ed58d:0x3ffbfc10 0x40109010:0x3ffbfc40 0x401090ad:0x3ffbfc60 0x40108c4d:0x3ffbfc80 0x40108c56:0x3ffbfca0 0x40108e24:0x3ffbfd00 0x40081f61:0x3ffbfd30 0x4008101c:0x3ffbfd50
Rebooting...
-------------------------------------------------------------------------------------------------------------------------------------------
According to my speculation,it is because that sendto API calls internal API,and internal API calls internal API.Sendto function nested too deeply in isr.As a result,program runaway.Is that right. Whether the interrupt function can call sendto functions?
Here is my code!
Code: Select all
static void IRAM_ATTR i2s_isr(void* arg)
{
I2S0.int_clr.val = I2S0.int_raw.val;
int prev_buffer=s_cur_buffer;
s_cur_buffer = !s_cur_buffer;
//if (s_isr_count == s_buf_height - 2) {
if (s_isr_count == s_buf_height)
{
sendto(sock,frame_end,SEND_END_LEN,0,(struct sockaddr*)&toAddr,sizeof(toAddr));
}
else
{
++s_isr_count;
i2s_fill_buf(s_cur_buffer);
// sendto(sock,s_dma_buf[prev_buffer],(LINE_WIDTH_WE_NEED)*sizeof(uint32_t),0,(struct sockaddr*)&toAddr,sizeof(toAddr));
sendto(sock,image1,(LINE_WIDTH_WE_NEED),0,(struct sockaddr*)&toAddr,sizeof(toAddr));
}
}
---------------------------------------------------------------------------------------------------------------------------------------
Guru Meditation Error of type InstrFetchProhibited occurred on core 0. Exception was unhandled.
Register dump:
PC : 0x00000000 PS : 0x00050133 A0 : 0x00000000 A1 : 0x3ffbfb80
A2 : 0x3ffbfbe0 A3 : 0x3ffbd754 A4 : 0xffffffff A5 : 0x00000000
A6 : 0x00000000 A7 : 0x00000000 A8 : 0x00000000 A9 : 0xffffffff
A10 : 0x3ffbfbe0 A11 : 0x00000000 A12 : 0x00000000 A13 : 0xffffffff
A14 : 0x00000000 A15 : 0x00000000 SAR : 0x00000000 EXCCAUSE: 0x00000014
EXCVADDR: 0x00000000 LBEG : 0x40109aec LEND : 0x3ffbfc64 LCOUNT : 0x3ffbfc10
Backtrace: 0x00000000:0x3ffbfb80 0x00000000:0x3ffbfba0 0x400ed19c:0x3ffbfbe0 0x400ed58d:0x3ffbfc10 0x40109010:0x3ffbfc40 0x401090ad:0x3ffbfc60 0x40108c4d:0x3ffbfc80 0x40108c56:0x3ffbfca0 0x40108e24:0x3ffbfd00 0x40081f61:0x3ffbfd30 0x4008101c:0x3ffbfd50
Rebooting...
-------------------------------------------------------------------------------------------------------------------------------------------
According to my speculation,it is because that sendto API calls internal API,and internal API calls internal API.Sendto function nested too deeply in isr.As a result,program runaway.Is that right. Whether the interrupt function can call sendto functions?