Control time of a function's execution time

Post here first, or if you can't find a relevant section!
mebab
Posts: 115
Joined: Mon Aug 24, 2020 12:42 pm
Answers: 4

Re: Control time of a function's execution time

Post 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.
ozcar
Posts: 144
Joined: Wed Apr 29, 2020 9:07 pm
Answers: 5

Re: Control time of a function's execution time

Post 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:

Code: Select all

#define CAP_DONE_MASK      		0x08
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.
mebab
Posts: 115
Joined: Mon Aug 24, 2020 12:42 pm
Answers: 4

Re: Control time of a function's execution time

Post by mebab »

Thanks all for your helpful contributions!
dotparsa
Posts: 1
Joined: Tue Mar 14, 2023 1:11 am

Re: Control time of a function's execution time

Post by dotparsa »

thank you dannyf. I totally understand!
Post Reply

Return to “General discussion”