Hello,
On Tuesday, 7 November 2023 02:51:21 AEST GJG wrote:
> I changed the failsafe on line 1318 of
> bcm2835.c to "unsigned long Failsafe = 10 * len * 1000;" I also added a
> debugging line on 1362.
>
> printf("Remaining Failsafe: %d\n", (10 * len * 1000) - Failsafe);
>
> Remaining CPU cycles left in the failsafe after this modification is
> ~300-1500. I don't see anymore data errors with this change.
>
> In my application code, I was writing to a address then reading the
> response. I think the timeout was stopping the transmission mid write and
> causing the data errors.
>
> Would the maintainer(s) be open to a function that allows the I2C timeout
> to be changed at runtime?
Yes, provided it is tested and documented.
Cheers.
> >>>> <
http://www.airspayce.com/mikem/bcm2835/group__constants.html#ggab59cd4
> >>>> 06976a819cff4505e978b27fcda46a451d6defc1119176f865305b0d8a3>>>>>
> >>>> and BCM2835_I2C_REASON_ERROR_DATA
> >>>>
> >>>> <
http://www.airspayce.com/mikem/bcm2835/group__constants.html#ggab59cd4
> >>>> 06976a819cff4505e978b27fcda9941bd8c8b79c99d2da1fb93bfdb9524> errors.
> >>>> Note, I did not change the firmware or hardware. All I did was install
> >>>> version 1.73 of the library, recompile my code with no changes, then
> >>>> run it and errors pop up almost every I2C read and write. When I
> >>>> reinstall version 1.71, everything works as expected, again with no
> >>>> changes to the code.>>>>
> >>>> I'm checking for errors like:
> >>>> uint8_t reason = bcm2835_i2c_write(&addr, sizeof(addr));
> >>>> if (reason != BCM2835_I2C_REASON_OK)
> >>>> {
> >>>>
> >>>> printf("Writing to FT6336 address %x failed with reason
> >>>>
> >>>> (%x)\n", addr, reason);
> >>>>
> >>>> }
> >>>> reason = bcm2835_i2c_read(&data, sizeof(data));
> >>>> if (reason != BCM2835_I2C_REASON_OK)
> >>>> {
> >>>>
> >>>> printf("Reading from FT6336 address %x failed with reason
> >>>>
> >>>> (%x)\n", addr, reason);
> >>>>
> >>>> }
> >>>>
> >>>> The most common error is BCM2835_I2C_REASON_ERROR_TIMEOUT
> >>>> <
http://www.airspayce.com/mikem/bcm2835/group__constants.html#ggab59cd4
> >>>> 06976a819cff4505e978b27fcda46a451d6defc1119176f865305b0d8a3>, however,
> >>>> calling bcm2835_i2c_read after a timeout error still fills the
> >>>> variable "data" with correct information from the FT6336 IC. Only
> >>>> BCM2835_I2C_REASON_ERROR_DATA
> >>>> <
http://www.airspayce.com/mikem/bcm2835/group__constants.html#ggab59cd4
> >>>> 06976a819cff4505e978b27fcda9941bd8c8b79c99d2da1fb93bfdb9524> causes the
> >>>> "data" variable to be incorrect. Why would this change between version
> >>>> 1.71 and 1.73? From reading the revision history, it seems like
> >>>> timeout checks were added to 1.73 but why would that cause
> >>>> BCM2835_I2C_REASON_ERROR_DATA
> >>>> <
http://www.airspayce.com/mikem/bcm2835/group__constants.html#ggab59cd4
> >>>> 06976a819cff4505e978b27fcda9941bd8c8b79c99d2da1fb93bfdb9524> in 1.73
> >>>> <
https://groups.google.com/d/msgid/bcm2835/69192eda-4837-4484-8c3b-7a5
> >>>> 7fe9fe7e0n%
40googlegroups.com?utm_medium=email&utm_source=footer> .
> >>> <
https://groups.google.com/d/msgid/bcm2835/CACXsFr1qrw_w5npiVxox6JULBkk
> >>> LTHZie5Dm4z5zsPrtMjbVmQ%
40mail.gmail.com?utm_medium=email&utm_source=foo
> >>> ter> .
> >>
> >> --
> >> You received this message because you are subscribed to the Google Groups
> >> "bcm2835" group.
> >> To unsubscribe from this group and stop receiving emails from it, send an
> >> email to
bcm2835+u...@googlegroups.com.
> >> To view this discussion on the web visit
> >>
https://groups.google.com/d/msgid/bcm2835/CA%2Bqqht4Th689pt%3DjwpOTTjEZAv
> >> K1WmAHjAkDX1v-eLZWfLWAuQ%
40mail.gmail.com
> >> <
https://groups.google.com/d/msgid/bcm2835/CA%2Bqqht4Th689pt%3DjwpOTTjEZ
> >> AvK1WmAHjAkDX1v-eLZWfLWAuQ%
40mail.gmail.com?utm_medium=email&utm_source=f
> >> ooter> .
> >
https://groups.google.com/d/msgid/bcm2835/CACXsFr1z3L%2BW_jkkdwvhob%2BdOnd
> > 3HLnNhBOgMFF3H7D0XTQ8qg%
40mail.gmail.com
> > <
https://groups.google.com/d/msgid/bcm2835/CACXsFr1z3L%2BW_jkkdwvhob%2BdO
> > nd3HLnNhBOgMFF3H7D0XTQ8qg%
40mail.gmail.com?utm_medium=email&utm_source=foo
> > ter> .
--
Mike McCauley VK4AMM
mi...@airspayce.com
Airspayce Pty Ltd 9 Bulbul Place Currumbin Waters QLD 4223 Australia
http://www.airspayce.com 5R3MRFM2+X6
Phone
+61 7 5598-7474