SPI Master
#1
Hello i'm using Pulpino's SPI Master part to read a external sensor  that it is connected to one of the zedboard's pmod. I have configurated the spi_master_clkgen spi_clk polarity to start in 1. I have done the next code to read the sensor's id but I don't get any success:

#include <utils.h>
#include <stdio.h>
#include <spi.h>
#include <bench.h>
int main() {
    
  int sensor_id; 
    
    spi_setup_master(1);
  *(volatile int*) (SPI_REG_CLKDIV) = 0x2;


    spi_setup_cmd_addr( 0x0f, 8,0,0); 
    spi_set_datalen(8);
    spi_start_transaction(SPI_CMD_RD, SPI_CSN0);
    spi_read_fifo(&sensor_id, 8);
    printf(" LPS25HB sensor id: 0x%x\n", sensor_id);
    return 0;
}

Reviewing the signal with a logic a analizer I got this result: SCLK does as many clocks that spi_Reg_clkdiv value is, the chip select when CS is asserted, it remains asserted indefinitely. MOSI only does one pulse and MISO remains idle.

Anyone can help?
Reply


Messages In This Thread
SPI Master - by istillaga - 10-19-2023, 08:34 AM
RE: SPI Master - by kgf - 10-27-2023, 11:24 AM
RE: SPI Master - by istillaga - 11-07-2023, 02:25 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)