You can chat about native SDK questions and issues here.

User avatar
By berkutta
#67221 I'm currently trying to get the SPI Interface running. I'm using the newest RTOS SDK from Github. My intention is to send exactly 1 Byte with the content 0xAA. But I get a big I don't know what on the data output. Any idea?

Code: Select allvoid spi_initialize()
{
    //Initialze Pins on ESP8266
   PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDI_U,FUNC_HSPIQ_MISO);
   PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDO_U,FUNC_HSPI_CS0);
   PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTCK_U,FUNC_HSPID_MOSI);
   PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTMS_U,FUNC_HSPI_CLK);
   

   SpiAttr pAttr;   //Set as Master/Sub mode 0 and speed 10MHz
   pAttr.mode=SpiMode_Master;
   pAttr.subMode=SpiSubMode_0;
   pAttr.speed=SpiSpeed_10MHz;
   pAttr.bitOrder=SpiBitOrder_MSBFirst;
   SPIInit(SpiNum_HSPI,&pAttr);
}

void ICACHE_FLASH_ATTR user_init(void)
{
    uart_div_modify(0, UART_CLK_FREQ / 115200);

    os_printf("SDK version:%s\n", system_get_sdk_version());

    wifi_set_opmode(0);

    uint32 data[1] = {0xAAAAAAAA};
    spi_initialize();

    while (true) {
   SpiData pDat;

   pDat.cmdLen=0;         ///< Command byte length
   pDat.addrLen=0;       ///< Address byte length
   pDat.dataLen=1;       ///< Data byte length.
   pDat.data=data;
   SPIMasterSendData(SpiNum_HSPI,&pDat);

        vTaskDelay(100);
    }
}
You do not have the required permissions to view the files attached to this post.