1

S1V30120 dectalk テキスト合成 IC のラッパーを ESP IDF を使って C 言語で書いてみます。次のコードで問題が発生しています。

printf("Hello world!\n");
esp_err_t ret;
spi_device_handle_t spi;
spi_bus_config_t buscfg={
    .miso_io_num=PIN_NUM_MISO,
    .mosi_io_num=PIN_NUM_MOSI,
    .sclk_io_num=PIN_NUM_CLK,
    .quadhd_io_num=-1,
    .quadwp_io_num=-1
};
spi_device_interface_config_t devcfg={
    .clock_speed_hz=750000,
    .mode=0,
    .spics_io_num=PIN_NUM_CS,
    .queue_size=7
};
ret=spi_bus_initialize(HSPI_HOST, &buscfg, 1);
assert(ret==ESP_OK);

ret=spi_bus_add_device(HSPI_HOST, &devcfg, &spi);
uint8_t rec[20];
assert(ret==ESP_OK);
uint8_t cmd[] = {0xAA, 0x04, 0x00, 0x05, 0x00}; // get information command
printf("waiting for rdy");
while (gpio_get_level(PIN_NUM_RDY) == 0){};
//create 2 transactions 1 for transmitting the GET INFORMATION command
//and 1 for getting the data back from the ic
spi_transaction_t t;
spi_transaction_t r;
memset(&t, 0, sizeof(t));
t.length=5*8;
t.tx_buffer=&cmd;
r.length=20*8;
r.rx_buffer=&rec;

ret = spi_device_transmit(spi, &t);
assert( ret == ESP_OK);
ret = spi_device_transmit(spi, &r);
assert(ret == ESP_OK);
printf((char*)r.rx_data);
/* Print chip information */
printf("Restarting now.\n");

接続は全二重モードである必要があり、正しく設定されていると確信しています。返される情報は 20 バイトである必要がありますが、エラーが発生しています

rxdata transfer > 32 bits without configured DMA

現時点では、役立つ可能性のある 2 つのコードに従っています。

esp idf での SPI の使用例: https://github.com/espressif/esp-idf/blob/3276a1316f66a923ee2e75b9bd5c7f1006d160f5/examples/peripherals/spi_master/main/spi_master_example_main.c

Arduino ide で dectalk ic を使用する例: https://electronza.com/arduino-due-s1v30120-text-speech-code/2/

dectalk ic プロトコル シート: https://github.com/MikroElektronika/Click_TextToSpeech_S1V30120/blob/master/datasheet/S1V30120%20Protocol%20Specification.pdf

esp idf の SPI ドキュメント: https://gitdemo.readthedocs.io/en/latest/api/peripherals/spi_master.html

プロトコル シートには、これまで見たことのないトランザクションの後に 16 バイトの 0x00 を送信することについても記載されています。

このすべての情報が十分に徹底されていることを願っています。助けていただける方に事前に感謝します。

4

1 に答える 1