glen
glen
這家夥很懶,什麼也沒寫!

注冊於 1年前

回答
3
文章
0
關注者
0

我沒有32的板子,只有802 哭暈 自己一天了沒改出來,我對照的32的先發了8位的0x91,然後發送了一個cmd,您給看一下這個demo對嗎

int master_spi_send_data(int clk, int type)
{

int *p;
int i;
char *cmd_buf = NULL;
char *tx_buf = NULL;

/*MASTER SPI configuratioin*/
wm_spi_cs_config(WM_IO_PB_14);
wm_spi_ck_config(WM_IO_PB_15);
wm_spi_di_config(WM_IO_PB_16);
wm_spi_do_config(WM_IO_PB_17);
printf("\r\n");


if (clk < 0)
{
    clk = 1000000;          /* default 1M */
}
if (-1 == type)
{
    type = 0;
}

if (0 == type)
{
    tls_spi_trans_type(0);
}
else
{
    tls_spi_trans_type(2);
}

tls_spi_setup(TLS_SPI_MODE_0, TLS_SPI_CS_LOW, clk);
cmd_buf = tls_mem_alloc(1);
memset(cmd_buf,  0, 1);
cmd_buf[0]=0x91;


char *buf = NULL;
buf = tls_mem_alloc(32);

printf("tx start cmdrn");
memset(buf, 0, sizeof(buf));

buf[0] = 0x5A;
buf[1] = 0x00;
buf[2] = 0x05;
buf[3] = 0x01;
buf[4] = 0x60;


// printf("SPI Master send 1500 byte, modeA, little endian\n");

tls_spi_write((u8 *)cmd_buf, 1);
printf("cmd=%02x\n",cmd_buf[0]);
tls_spi_write((u8 *)buf, (buf[1] << 8) | buf[2]);


tls_mem_free(cmd_buf);
tls_mem_free(tx_buf);
    tls_mem_free(buf);
printf("after send\n");
return WM_SUCCESS;

}

@isme w802 hspi從機通信時,中斷進不去,這個跟主機有關嗎,有沒有與hspi從機能夠直接通的demo

w802 hspi從機通信時,中斷進不去,這個跟主機有關嗎,有沒有與hspi從機能夠直接通的demo

發布
問題