Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 7512

General • Re: Basic SPI question

$
0
0
Identical result unfortunately

Code:

int main(){      stdio_init_all();       // For printing to serial over USB       spi_init(SPI_PORT, 1000000);      spi_set_format(SPI_PORT, 8, SPI_CPOL_1 , SPI_CPHA_1, SPI_MSB_FIRST);      gpio_set_function(MISO, GPIO_FUNC_SPI);      gpio_set_function(SCLK, GPIO_FUNC_SPI);      gpio_set_function(MOSI, GPIO_FUNC_SPI);      gpio_set_function(CS, GPIO_FUNC_SPI);      spi_set_slave(SPI_PORT, true);      while(true)      {            uint8_t read_command[4];            spi_read_blocking(SPI_PORT, 0, read_command, 4);                                    printf("Data read: %c%c%c%c \r\n", read_command[0], read_command[1], read_command[2], read_command[3]);      }}

Code:

Data read: ÐQData read: ÐQData read: ÐQData read: ÐQData read: ÐQData read: ÐQData read: ÐQ// Power pulled to slave hereData read: LOADData read: LOADData read: LOADData read: LOADData read: LOADData read: LOADData read: LOADData read: LOAD

Statistics: Posted by Lonewolff — Thu Apr 17, 2025 11:00 pm



Viewing all articles
Browse latest Browse all 7512

Trending Articles