I would like to realize a simple spi interface by using 1 clock resource only.
Therefore clk, connected to an out port, should be the spi clock.
The problem is that serialization produces 1 unwanted extra clock cycle
at beginning of transmission, so 9 cycles are produced instead of 8.
Thanks for any solutions.
Code: Select all
# include <xs1.h>
out buffered port:8 outP = XS1_PORT_1A ;
out buffered port:1 outClock = XS1_PORT_1B ;
clock clk = XS1_CLKBLK_1 ;
int main ( void )
{
configure_clock_rate (clk , 100 , 8);
configure_out_port (outP , clk , 0);
configure_port_clock_output ( outClock , clk );
start_clock (clk );
outP<:0xba; //example data (MOSI)
sync(outP);
stop_clock(clk);
while(1);
return 0;
}