Page 2 of 2
Re: Control time of a function's execution time
Posted: Fri Feb 24, 2023 7:40 pm
by mebab
In fact, these values (0 and 8) exist before and after the photo is taken in a normal situation. When it fails, there is no evidence of what happens.
Anyway, since it is a rare event I used a Watchdog timer to bypass the issue if it happens.
Thanks for all your valuable comments.
Re: Control time of a function's execution time
Posted: Sun Feb 26, 2023 9:29 pm
by ozcar
dannyf wrote: Fri Feb 24, 2023 1:30 pm
before and after the mentioned while loop in normal situation, they are 0 and 8, respectively.
that means that the routine returns execution to the main loop, just with the unexpected value (8). you will need to see 1) why it returns that value; and 2) how you would continue execution if that value is returned.
so the question now is much simpler.
The troublesome function was:
Code: Select all
myCAM.get_bit(ARDUCHIP_TRIG , CAP_DONE_MASK)
In ArduCAM.cpp:
Code: Select all
//Get corresponding bit status
uint8_t ArduCAM::get_bit(uint8_t addr, uint8_t bit)
{
uint8_t temp;
temp = read_reg(addr);
temp = temp & bit;
return temp;
}
... and, in ArduCAM.h:
So, a return value of 0 or 8 would be normal.
Not ever returning a value of 8 is perhaps unexpected (in other words, to continue to return 0 no matter how many times you try). However, I thought that possibility had been excluded? If so, maybe sometimes it does not return either 0 or 8, in that it does not return at all. Either way, if you really wanted to know why you would have to dig deeper, into Arducam and perhaps beyond.
Re: Control time of a function's execution time
Posted: Wed Mar 01, 2023 5:37 pm
by mebab
Thanks all for your helpful contributions!
Re: Control time of a function's execution time
Posted: Tue Mar 14, 2023 1:16 am
by dotparsa
thank you dannyf. I totally understand!