SPI documentation
-
- Posts: 201
- Joined: 05 Sep 2016 22:27
SPI documentation
Hi PoltoS,
the online documentation for SPI has some 404 pages, at least SPISetting and Due Extended SPI usage.
For SetDataMode there are 4 possible values for the mode named, but not described. It is written it is clock polarity and phase, but which mode is which combination?
Would be great if you can check and update the documentation.
I have a cheap MFRC522 RFID reader which uses SPI and I would like to connect it to the Z-Uno...
Regards,
Andreas.
the online documentation for SPI has some 404 pages, at least SPISetting and Due Extended SPI usage.
For SetDataMode there are 4 possible values for the mode named, but not described. It is written it is clock polarity and phase, but which mode is which combination?
Would be great if you can check and update the documentation.
I have a cheap MFRC522 RFID reader which uses SPI and I would like to connect it to the Z-Uno...
Regards,
Andreas.
fhem.de - ZWave development support
-
- Posts: 201
- Joined: 05 Sep 2016 22:27
Re: SPI documentation
Hi,
so for the modes it seems that this is the standard definition for the polarity and the phase:
Mode CPOL CPHA
0 0 0
1 0 1
2 1 0
3 1 1
Regards,
Andreas.
so for the modes it seems that this is the standard definition for the polarity and the phase:
Mode CPOL CPHA
0 0 0
1 0 1
2 1 0
3 1 1
Regards,
Andreas.
fhem.de - ZWave development support
-
- Posts: 201
- Joined: 05 Sep 2016 22:27
Re: SPI documentation
Hi PoltoS,
in the documentation for SPI the call for SPISettings or SPI.beginTransaction() is described as
, but this does give an compiler error:
In the SPI lib for the ZUNO the beginTransaction is defined as , in the SPI lib for the Arduino it is defined as
I tried to adapt the ZUNO lib, but it seems that with the sdccp compiler only a pointer is allowed.
So I use to initialize the settings (by the way, in the example there is a "14000000" given, which seems to large...) and then just pass the pointer to SPIS to beginTransaction():
Is that the intended way? If yes, then the documentation should be adapted. If not, how to do it correctly?
Best regards,
Andreas.
in the documentation for SPI the call for SPISettings or SPI.beginTransaction() is described as
Code: Select all
SPI.beginTransaction(SPISettings(14000000, MSBFIRST, SPI_MODE0));
Code: Select all
no viable conversion from 'SPISettings' to 'SPISettings *'
Code: Select all
void beginTransaction(SPISettings * settings);
Code: Select all
inline static void beginTransaction(SPISettings settings)
So I use
Code: Select all
SPISettings SPIS(4000000, MSBFIRST, SPI_MODE0);
Code: Select all
SPI.begin();
SPI.beginTransaction(&SPIS);
Best regards,
Andreas.
fhem.de - ZWave development support
Re: SPI documentation
This is correct, we can not pass objects as parameters but reference (pointer) only. The API is slightly different from Arduino.
14MHz looks like a typo. Fixed
14MHz looks like a typo. Fixed
-
- Posts: 201
- Joined: 05 Sep 2016 22:27
Re: SPI documentation
Hi PoltoS,
thnx for fixing the documentation, but the description for SPISettings is still showing the "old" syntax with the object:Would be great if you can update that as well.
Regards,
Andreas.
thnx for fixing the documentation, but the description for SPISettings is still showing the "old" syntax with the object:
Code: Select all
SPI.beginTransaction(SPISettings(14000000, MSBFIRST, SPI_MODE0))
Regards,
Andreas.
fhem.de - ZWave development support
Re: SPI documentation
Done. We will soon make an example with SPI.
Have you made something meanwhile
Have you made something meanwhile
-
- Posts: 201
- Joined: 05 Sep 2016 22:27
Re: SPI documentation
Hi PoltoS,
working with the simple library for the RCF522 is not successfull, the sketch is resetting after a while or when I present the tag to the reader. I gave up on this one and will try again if you release a new version, I can only think of some internal problems. This is described here.
In the meantime I tried to convert a larger library for the RFC522 from the Arduino to the ZUNO, but I am also stuck there. I end up with an "unknown error" saying that the index for the list is ouf of bounce, but there is no linenumber, so I can't find the issue... This is described here
Other than these two failed attempts I did not work with the SPI library.
Will the new example for the SPI come along with a new version of the ZUNO? Are there plans for the next release?
Regards,
Andreas.
working with the simple library for the RCF522 is not successfull, the sketch is resetting after a while or when I present the tag to the reader. I gave up on this one and will try again if you release a new version, I can only think of some internal problems. This is described here.
In the meantime I tried to convert a larger library for the RFC522 from the Arduino to the ZUNO, but I am also stuck there. I end up with an "unknown error" saying that the index for the list is ouf of bounce, but there is no linenumber, so I can't find the issue... This is described here
Other than these two failed attempts I did not work with the SPI library.
Will the new example for the SPI come along with a new version of the ZUNO? Are there plans for the next release?
Regards,
Andreas.
fhem.de - ZWave development support
Re: SPI documentation
We have changed nothing in SPI, so the example will work with the existing too.
We have fixes some potential problems and will release the new version next week.
From what we see, most problems arise from stack overflow. We will soon add some "debugging" tools to notify user about stack overflow and some other problems.
We have fixes some potential problems and will release the new version next week.
From what we see, most problems arise from stack overflow. We will soon add some "debugging" tools to notify user about stack overflow and some other problems.
Re: SPI documentation
May be try to minimize the number of wrapped function calls and make more global variables instead of local. This will free some stack.