aroy
Newbie level 5
Hi! I'm working on a data logging project which involves an ADC, FGPA and an SPI interface. The way I am going about it is the following:
1. parallel 14-bit data from the ADC is stored in registers inside the FPGA
2. when i send a command to start reading the data from the registers using the spi interface, the data in the registers is loaded into a parallel-in/serial-out shift register
3. the data from the shift registers is transferred across the MISO bus
the protocol of the spi is the following: 2 bytes of instruction (8-bit address followed by 8-bits of data) sent on the MOSI bus. once the fpga receives this instruction, the PISO accesses the correct register given by the address and starts the serial conversion.
I am a little confused about how to go about the difference in clock speeds. the fpga and the internal logic (PISO shift register) run @ 48 Mhz while the bitrate of SPI bus is 250 KHz. so if the PISO is converting parallel data into serial MUCH faster than the transfer rate, won't I start losing samples.
Or should the PISO convert data only at the rising/falling edge of the SPI clock. i was also looking into whether i need to synchronize the two clocks using 2 D-FFs.
any insight into this is appreciated. thanks!
1. parallel 14-bit data from the ADC is stored in registers inside the FPGA
2. when i send a command to start reading the data from the registers using the spi interface, the data in the registers is loaded into a parallel-in/serial-out shift register
3. the data from the shift registers is transferred across the MISO bus
the protocol of the spi is the following: 2 bytes of instruction (8-bit address followed by 8-bits of data) sent on the MOSI bus. once the fpga receives this instruction, the PISO accesses the correct register given by the address and starts the serial conversion.
I am a little confused about how to go about the difference in clock speeds. the fpga and the internal logic (PISO shift register) run @ 48 Mhz while the bitrate of SPI bus is 250 KHz. so if the PISO is converting parallel data into serial MUCH faster than the transfer rate, won't I start losing samples.
Or should the PISO convert data only at the rising/falling edge of the SPI clock. i was also looking into whether i need to synchronize the two clocks using 2 D-FFs.
any insight into this is appreciated. thanks!