I2S documentation

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

king2
Posts: 98
Joined: Mon May 28, 2012 1:57 pm
Been thanked: 2 times

I2S documentation

Post by king2 »

Hi!

I'm relatively new to ChibiOS, and new to ChibiOS 3.x, so please forgive me my newbie questions.

Now I'm trying to use STM32F429 with UDA1380 codec via I2S and I have found no documentation about how to do this. Yes, I know about auto-made documentation, but I have not found nor examples suitable for using, neither best practices docs.

In example (STM32F4xx/I2S) I have found some config, and some exchange process from I2S chip to MCU, but I cannot found complete docs, how to configure I2S, and what is I2SConfig (ok, second param in documentation is tx_buffer, but it is i2s_rx_buf in example).
So, it is for receiving audio or for sending?

Why palSetPadMode is called after I2S was started? Is it mistake, or it does not matter, or there are some reasons to do it this way?

It calls i2sStartExchange() function, and i2sStopExchange() when pressing a button, and, as I understand, i2sStartExchange() does exchange till i2sStopExchange() will be called. But what is i2sStartExchangeContinuous() then?

There is i2scallback() function in example that does nothing, so is it for receiving or sending or both?
What does this example, at least?!

I2SConfig have first 'mode' field. In documentation I have found that it is 'I2S mode selection' and reference to header file (ok, mode is i2smode_t).Yet another click on it and we know that it is have uint32_t type. OK, but what should I put here? Which variants? What does mean every variant? What important I have to know to use each of them (do not forget to call function doWhatINeedSuccessfully() after i2sStart(), for example :))?

Sorry for so many questions, may be there is a some hidden documentation pages, where I can found answers?
It is not for I2S only, but for other subsystems too..

Thank you in advance!
Last edited by king2 on Wed Aug 12, 2015 3:29 pm, edited 1 time in total.
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: I2S documentation

Post by Giovanni »

Hi,

The I2S driver is very new so it is possible there are problems in the demo, I will review it.

About the reason for many of your questions, the answer would not be in the documentation but in the STM32 Reference Manual. For example regarding programming the pins after starting the driver, it is done this way to avoid glitches on the outputs, before starting the driver I2S/SPI clocks are disabled.

There is no i2sStartExchangeContinuous() just i2sStartExchange(), are you sure we are talking of the same thing?

Giovanni
king2
Posts: 98
Joined: Mon May 28, 2012 1:57 pm
Been thanked: 2 times

Re: I2S documentation

Post by king2 »

Thanks for answering me!

I have updated my question, sorry, I will repeat it here:
I2SConfig have first 'mode' field. In documentation I have found that it is 'I2S mode selection' and reference to header file (ok, mode is i2smode_t).Yet another click on it and we know that it is have uint32_t type. OK, but what should I put here? Which variants? What does mean every variant? What important I have to know to use each of them (do not forget to call function doWhatINeedSuccessfully() after i2sStart(), for example :))?

I think I cannot found such answers in STM32 documentation, because it is about ChibiOS. Maybe it does mean some modes, desribed in STM32 documentation, but ok, I can think that it is mode that I should set before starting I2S, but which constants are related to it in ChibiOS?

What about i2sStartExchangeContinuous() - I have found it at http://chibios.sourceforge.net/docs/hal ... river.html ('referenced by i2sstate_t I2SDriver::state' section).

Have ChibiOS some more complex documentation except auto-generated one?

Thanks!
king2
Posts: 98
Joined: Mon May 28, 2012 1:57 pm
Been thanked: 2 times

Re: I2S documentation

Post by king2 »

Wow. I just realized that I have referenced you at 2.5.1 documentation.
And I cannot find I2SDriver in 3.0.1 documentation.. :(
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: I2S documentation

Post by Giovanni »

Hi,

The documentation is extracted by the source code, if in doubt open i2s_lld.c/h and read :)

Anyway: http://chibios.sourceforge.net/docs3/ha ... _i2_s.html

Giovanni
king2
Posts: 98
Joined: Mon May 28, 2012 1:57 pm
Been thanked: 2 times

Re: I2S documentation

Post by king2 »

Wow, you are wizard, how you did it? :)
There is no links to HAL from left menu of documentation page!

I got your point of view about documentation - best documentation is sources. :)

p.s. I'm blind dumb idiot! I missed that 3.0.0 HAL is third link on the page, just between 1.0.0 and 2.6.9 links :)
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: I2S documentation

Post by Giovanni »

Good point, I will add direct links to the documents from the menu on the left. It is not immediately obvious where it is.

Giovanni
Bendix
Posts: 2
Joined: Fri Aug 14, 2015 9:49 am

Re: I2S documentation

Post by Bendix »

Since we're already talking about I2S documentation ... how do you configure the I2S MCLK frequency?
I didn't have a chance to try it out myself and play around with it yet, but I can't find any hints in the documentation.
Also, is MCLK output enabled by default?
Needless to say, I'm new to ChibiOS aswell ...
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: I2S documentation

Post by Giovanni »

Hi,

This kind of details (configuration) are found in the STM32 Reference Manual, the HAL just initialize things in the way you specify in mcuconf.h, the meaning of those settings are STM32-specific.

Giovanni
king2
Posts: 98
Joined: Mon May 28, 2012 1:57 pm
Been thanked: 2 times

Re: I2S documentation

Post by king2 »

No, MCLK is not configured by default.
You should initialize I2S driver configuration, and tell that you want additional values to be set to registers.

For example:

Code: Select all

    // last parameter is MCKOE (0x0200) + divider (16KHz stereo / 16 bit)
    static const I2SConfig i2scfg2 = { i2s_tx_buf, NULL, I2S_BUF_SIZE, i2scallback_out, 0, 0x0200 | 13 };
    i2sStart(&I2SD2, &i2scfg2);
Post Reply