I am trying to read the whole FIFO buffer in the lis3dh of the Hannah with 1 single read. The following code:
local tempbuf = i2cPort.read(address, command, number);
returns an error “[Device] ERROR: no memory in i2c.read”
The number of bytes being read “number” is 192 or 32 values of 2 bytes for 3 channels. If I execute the same code but with number of 6, no error comes up.
Any suggestions on the maximum number allowed?
Could it be an issue of the Imp running out of memory, since the overall code is fairly large, about 900 lines.
Well, the error says it all really: it couldn’t allocate a block of “number” bytes. 900 lines is large, but by no means the largest we’ve heard of. Your imp must be right on the edge if it can’t find 192 more bytes. Does it fail this way every time? Are you sure that “number” isn’t accidentally enormous?
Have checked, the number is correct. Routine gets called from number of places with values from 6 to 192. fails when anything above 50 or so…
What is very strange is that I have commented out a fairly large (unused) code section but it made no difference… Any input?
Post your code (or email me)? Perhaps you’re doing something that causes lots of memory fragmentation, so there aren’t 192 consecutive bytes free.