Hello at all
I have a question about PIC's spi module.
I am using a pic18F46k22 with spi module in slave mode but I have synchronization problems with the bytes I send from the master.
I have found an unorthodox way to synchronize received bytes, but sometimes this doesn't happen
This is the first time I use this mode of operation and I can't solve it.
Can someone help me
I am attaching the test file I am using
Thank you
SPI module as a slave
Moderator: Benj
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: SPI module as a slave
Hi Bruno,
First I would do a 1 second flasher test just to confirm you are running at the top speed of 64MHz. It could be the device is running slower then you think.
If the device is running at the right speed then what rate is the master sending out the SPI, could this be slowed down?
I have developed a SPI slave device and remember having similar problems, I may have ended up having to add small delays between the bytes sent by the master to allow the slave to keep up.
First I would do a 1 second flasher test just to confirm you are running at the top speed of 64MHz. It could be the device is running slower then you think.
If the device is running at the right speed then what rate is the master sending out the SPI, could this be slowed down?
I have developed a SPI slave device and remember having similar problems, I may have ended up having to add small delays between the bytes sent by the master to allow the slave to keep up.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: SPI module as a slave
Hi Benj
Thank you for your support.
I checked the frequency of the micro and it is correct: I try to put some delays between the data sending macros, as you suggested.
Is there a better way to read the data than I did?
I tried to make a connection between two micro in I2C, one as master and one as slave, and everything works fine. Instead in SPI, when I start the micro, the bytes I receive on the slave are not always in the position where the master sends them.
best regards
Thank you for your support.
I checked the frequency of the micro and it is correct: I try to put some delays between the data sending macros, as you suggested.
Is there a better way to read the data than I did?
I tried to make a connection between two micro in I2C, one as master and one as slave, and everything works fine. Instead in SPI, when I start the micro, the bytes I receive on the slave are not always in the position where the master sends them.
best regards