I’m using 4.2 because I want 4.3 to ‘settle down’ a bit before I switch to it.
I’m trying to use the variant of WriteRead that accepts a third parameter (readOffset). The value seems to be ignored, however.
This: https://www.ghielectronics.com/community/forum/topic?id=13121&page=2#msg134304 kind of suggests that this may be a known bug in some version of the Gadgeteer.
Anyone know for sure? Are there release notes anywhere?
@ philAtkin - It still appears to be an issue in 4.2.
http://gadgeteer.codeplex.com/SourceControl/latest#Main/GadgeteerCore/Libraries/Core/SPI42/SPI.cs line 276 and 291, the last parameter should be the passed parameter readOffset I believe, not 0.
I worked around it by breaking up the read and write calls.
Where is the corresponding code for 4.3? I can see the NativeSPI class but I guess there is a layer above it to offer the abbreviated forms of Write and WriteRead. I can’t find it so can’t check that the failure to pass on the readOffset has been fixed.
Is it possible to fix this code and compile the fixed version?
And yes - the bug is easy to work around. In my case I can’t split it into separate Write and Read transactions because the chip I’m working with doesn’t tolerate the chip select going inactive between the two. So I have to read into a larger buffer than I want, and discard the first few bytes. This is unfortunate because I want to read a lot of data, and so I need to copy a lot of data to achieve this.
As far as I know, Microsoft rewrote a lot of the code for 4.3, or at least changed a lot of stuff around so I am not sure where it wound up. You can always download the Gadgeteer source, make the fix, and use that in your projects. But you will need to be careful with references since our mainboards and modules are compiled against the shipping version of the DLL so they will try to bring that in as a reference.
I would just use spi directly through nermf. Keep gageteer for everything else.
Sorry Gus but I’m new to a lot of this. Could you amplify and explain what you mean, please?
NETMF does not have a problem with SPI, Gadgeteer code does… which uses SPI internally.
So instead of using Gadgeteer.SPI…something something
Use a simple NETMF
SPI MySPI = new SPI(…);