glen
glen
这家伙很懒,什么也没写!

注册于 8月前

回答
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

发布
问题