Skip to main content
Super User
January 25, 2023
Solved

How to get data via the SAI out of the STM32H743 ? (async slave mode) i get nothing - frustrating .

  • January 25, 2023
  • 3 replies
  • 1588 views

i had I2S 16bit out in slave mode running, but with 32bit data no success. always wrong byte order.

so i try SAI , slave mode, 32bit data. but nothing coming from SAI....check with DSO.

also DMA -> callbacks for half + full buffer never triggered.

i dont know, what i am doing wrong, anyone can help ?

i did (CubeIDE -> HAL ...) :

init from HAL:

 MX_SAI1_Init();

callbacks:

 HAL_SAI_RegisterCallback(&hsai_BlockA1, HAL_SAI_TX_HALFCOMPLETE_CB_ID, HAL_SAI_TxHalfCpltCallback);

 HAL_SAI_RegisterCallback(&hsai_BlockA1, HAL_SAI_TX_COMPLETE_CB_ID, HAL_SAI_TxCpltCallback);

DMA init:

 fresult = HAL_DMA_Init(&hdma_sai1_a);

start DMA:

fresult = HAL_SAI_Transmit_DMA(&hsai_BlockA1, (uint8_t *)playbuf , (sizeof(playbuf))/2);

i think, SAI should run now and via callbacks data send...but nothing happens.

whats wrong , missing... ??

    This topic has been closed for replies.
    Best answer by AScha.3

    got it working.

    +

    what STM could do better:

    1. clear description, what is the size of a "slot" (and what is, when you set it wrong).
    2. change vage description on what DMA is to set: not "amount of data", but "number of transfers"

    so you know, blocksize is not in bytes , but in size of transfer element (maybe byte or 16...32 bit)

    now correct timing on 32bit data:

    0693W00000Y9OQMQA3.png 

    --- what was not possible with I2S - although no fault is in errata about i2s not working if data > 16 bit.

    3 replies

    Technical Moderator
    January 25, 2023

    You probably forgot to configure the MPU, for which there is a post in the Knowlede Base.

    Does that help you?

    Regards

    /Peter

    AScha.3Author
    Super User
    January 25, 2023

    thx for response.

    MPU ? i dont use, or need i use it, when SAI should do something?? i use "SCB_CleanDCache_by_Addr()" to clear cache. but ... why SAI doing nothing, cache or not ?

    AScha.3AuthorAnswer
    Super User
    January 28, 2023

    got it working.

    +

    what STM could do better:

    1. clear description, what is the size of a "slot" (and what is, when you set it wrong).
    2. change vage description on what DMA is to set: not "amount of data", but "number of transfers"

    so you know, blocksize is not in bytes , but in size of transfer element (maybe byte or 16...32 bit)

    now correct timing on 32bit data:

    0693W00000Y9OQMQA3.png 

    --- what was not possible with I2S - although no fault is in errata about i2s not working if data > 16 bit.