You can chat about native SDK questions and issues here.

User avatar
By edsuperfix
#89098 Hi,
I try to read 8bit data from miso (0x40) when sending 8bit mosi (0xFF) - like my printscreen.
My SPI confing:
Code: Select all...
spi_config_t spi_config;
   spi_config.interface.val = SPI_DEFAULT_INTERFACE;
   spi_config.intr_enable.val = SPI_MASTER_DEFAULT_INTR_ENABLE;
   spi_config.interface.cs_en = 0;
   spi_config.interface.miso_en = 1;
   spi_config.interface.bit_tx_order = SPI_BIT_ORDER_LSB_FIRST;
   spi_config.interface.byte_tx_order = SPI_BYTE_ORDER_MSB_FIRST;
   spi_config.mode = SPI_MASTER_MODE;
   spi_config.clk_div = SPI_2MHz_DIV;
   spi_config.event_cb = NULL;   //spi_event_callback;
   spi_init(HSPI_HOST, &spi_config);

My Read function:
Code: Select alluint8_t radio_write_read(uint8_t val){
   uint32_t buf_out = val << 24; // uint8_t to uint32_t
   uint32_t buf_in; //expected 0x40;
   spi_trans_t trans = { 0 };
        trans.bits.val = 0;
   trans.bits.cmd = 0;
   trans.bits.addr = 0;
   trans.bits.mosi = 8;
   trans.mosi = &buf_out;
   trans.miso = &buf_in;
   spi_trans(HSPI_HOST, &trans);
        return buf_in;

When I read buf_in I have 0x0. When I add trans.bits.miso I have 16bit in clock line.
I'm beginer with esp8266 rtos app :( I can send data to SPI with success but I can't read data from MISO when sending data to MOSI.

I would be grateful for any help and a fragment of working code or suggestions.

Sorry for my engish but it is not my native language :(

Nowa notatka.jpg
You do not have the required permissions to view the files attached to this post.