EDIT: Firstly I wrote it a bit confusing way. So let me summarize my problem. This is something like answer to comment bellow.
(1) I am trying to make somethin like visible light communication based on LED as independent TX part and photodiode with MCP3008 as RX part. I am attaching a photo of my circuit I currently use. The resristor on the TX part has 10 ohms resistivity and the resistor on the RX part has 10K ohms.
(2) I want to receive data on 10 kHz frequency (Code from the TX part: time.sleep(delay)
delay is set to 0.0001). This is why I thought that I need to apply Nyquist sampling theorem. This theorem says: Sampling frequency shoult be at least 2-times higher as sampled frequency. So I used 22 kHz frequency on the SPI bus, because I thought that this is my sampling frequency for digital signal of LED (picture bellow - last line marked as 14 TXD). It does not work, so I was trying to find proper frequency to read some of the data and this is why I use 480,750 kHz. This frequency gives me the closest result for my data sent form TX.
(3) Unfortunately, I do not have a scope, so I can not show you exact shape of signals. I use a PISCOPE for some analysis (picture above). The bottom GPIO pin is for sending information using LED. I sent this sequence, which is capturend on the PISCOPE: 000011110101100101010001001111010011110100111110. The RX part recieve after some management this sequence: 1011001001000100111010011101 (First eight and last eught bits from TX sequence are cut, because those are only for communication starting and ending. There you cn see that a lot of bits are lost or doubled - this is why my RX sequence start with 1. The 1 is from start sequence, which has, as it seems to be, on bit doubled).
(4) I explain to you already what I mean by a Nyquist. I mean Nyquist-Shanonn sampling theorem.
Question: So my question is. How can I set a proper SPI bus frequency (sampling frequency?) for the 10 kHz if I want to receive all the sent bits in correct oreder? I am new in this field, so any kind of help will be much appreciated. Thank you and sorry for my brief explanation above :-)
(2) SPI slave randomly missing bits in response: https://electronics.stackexchange.com/questions/515225/spi-slave-randomly-missing-bits-in-response/515256#515256. Happy learning. Cheers.
– tlfong01 Mar 05 '21 at 02:43