Created Mon, 23 Nov 2015 22:19:09 +0000 by PICedh
Mon, 23 Nov 2015 22:19:09 +0000
Hello,
The function Wire.requestFrom doesn't work with a board Chipkit Max32 if the length of the buffer requested is > 3 bytes. There is no such limitation with the board Chipkit Uno32 (I have tested the same program with both boards)
In fact the following statement in twi.c /twi_readFrom is looping because the interrupt doesn't set the status as idle
while(TW_IDLE != TW_STATUS) { asm volatile("nop"); }
Does someone already tested Wire lib with Max32 with a buffer > 3 bytes ?
Thanks
Eric
Thu, 26 Nov 2015 21:39:55 +0000
Hi I have added in the wire lin a timeout of 10000 cycles in order to avoid blocking but I would like the issue with MAX32.
Thanks
static volatile uint32_t twi_timeout; .... twi_timeout = 0; // wait for read operation to complete while((TW_IDLE != TW_STATUS) && (twi_timeout < 10000)) { asm volatile("nop"); twi_timeout++; } if (twi_timeout == 10000) return 0;
Thu, 26 Nov 2015 22:31:56 +0000
The timeout is a non-issue with the very latest version of Wire.h / DTWI.h. A bug was found recently which caused it to never return in certain circumstances. A timeout is not needed with the newest version since it always returns when it should.
If you want to grab the latest versions of the two libraries in question from github you are welcome to try them out:
https://github.com/chipKIT32/chipKIT-core/tree/master/pic32/libraries/DTWI https://github.com/chipKIT32/chipKIT-core/tree/master/pic32/libraries/Wire
Mon, 30 Nov 2015 20:08:51 +0000
Many thanks, it works on Max32 with the new lib
Eric