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
#2
Hard to say.. this looks to be physical, so the first question is actually is the sensor connected properly, reacting to other SPI commands (apart from PULPissimo). Maybe a rate issue, I/O voltage issue ?
Visit pulp-platform.org and follow us on twitter @pulp_platform
Reply
#3
(10-27-2023, 11:24 AM)kgf Wrote: Hard to say.. this looks to be physical, so the first question is actually is the sensor connected properly, reacting to other SPI commands (apart from PULPissimo). Maybe a rate issue, I/O voltage issue ?

Thanks for the response. I have solved it. The problem was in the clock divider
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)