Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

PSoC™ 4 Forum Discussions

MaMi_1205306
Level 6
50 solutions authored 25 likes received 250 sign-ins
Level 6

Dear Sirs and Madams,

 

We implemented it by referring to the I2S usage example of Hardware Abstraction Layer(HAL) from the question below.

https://community.infineon.com/t5/PSoC-4/I2S-sample-project-for-PSoC4S-with-Modus-Toolbox/td-p/36045...

 

After initializing the I2S transmitter in Snippet 1, running I2S transmit streaming in Snippet 3.

However, the last function in the call tree below will enter an infinite loop.

 

snippet_cyhal_i2s_async_transmit_streaming()

=> cyhal_i2s_enable_event()

=> _cyhal_audioss_update_enabled_events()

=> obj

=> interface

=> convert_to_pdl()

=> HardFault_Handler()

=> Cy_SysLib_ProcessingFault()

 

So We have these questions :

(1) Should cyhal_i2s_t i2s in initialization function and send streaming function be a global variable?

(2 ) The async_tx_buffer and async_tx_length values in i2s are zero. Need to initialize?

(3 ) Are there any other settings required to operate I2S?

(4) Is it possible to provide us an I2S sample project that can run on the PSoC4S MAX BSP?

 

 

Regards,

0 Likes
4 Replies
Ekta
Moderator
Moderator 250 solutions authored 100 likes received 250 sign-ins
Moderator

Hi @MaMi_1205306 

Here are the answer to your questions:

(1) Should cyhal_i2s_t i2s in initialization function and send streaming function be a global variable?

Yes,  the cyhal_i2s_t i2s initialization should be kept as a global variable. Currently, we do not have any code example for PSoC 4S Max device that uses HAL I2S. But you can refer to the following code example for PSoC 6, in which I2S is used for transmitting data (to configure the audio codec): PSoC 6 PDM to I2S.

You can see in the code example that all the data structures used for configuring the I2S block are kept as global.

(2) The async_tx_buffer and async_tx_length values in i2s are zero. Need to initialize?

Can you please provide more details regarding which buffer you have mentioned here? I can then check on that and get back to you.

(3 ) Are there any other settings required to operate I2S?


I don't think that any other configuration apart from what is mentioned in the snippet is required to configure the I2S. However, I will confirm the same by creating a project at my end.

(4) Is it possible to provide us an I2S sample project that can run on the PSoC4S MAX BSP?

I will try to create one for you and attach it as the next response.

Best Regards
Ekta

MaMi_1205306
Level 6
50 solutions authored 25 likes received 250 sign-ins
Level 6

Ekta-san,

 

Thank you for your support.

I was also referencing the PSoC6 I2S sample project on Github.

When I confirmed for the main.c file in the project, it was also composed of HAL, and the HAL of PSoC4 and PSoC6 was the same, so I thought that this file could be diverted as it is.

We are currently requesting confirmation of operation using that file.

Perhaps, in our problem, I feel that there is an omission in the description of the settings.

 

Regards,

0 Likes
MaMi_1205306
Level 6
50 solutions authored 25 likes received 250 sign-ins
Level 6

Ekta-san,

 

Modus Toolbox I2S sample project for PSoC6

https://github.com/Infineon/mtb-example-psoc6-i2s

 

We made the above PSoC6 I2S sample project compatible with PSoC4SMAX.

The changes are as follows:

 

(0) Change BSP of PSoC6 to PSoC4S MAX

(1) "clock_init() is comment out"

(2)  Change the "/* Initialize the I2S */" as below:

 // cyhal_i2s_init(&i2s, &i2s_pins, NULL, NC, &i2s_config, &audio_clock);

 cyhal_i2s_init(&i2s, &i2s_pins, NULL, &i2s_config, NULL);

(3)  "cyhal_system_sleep()" is comment out

 // cyhal_system_sleep();

(4)  Change the Device Configurator as below:

MaMi_1205306_1-1659585862073.png

 

I was able to avoid the build error with the above changes, but it doesn't work properly.

Just in case, I am attaching the project, so could you confirm it?

Also, could you please provide us a sample code that runs on PSoC4S MAX?

 

Regards,

0 Likes
MaMi_1205306
Level 6
50 solutions authored 25 likes received 250 sign-ins
Level 6

As for modifying the I2S sample project to PSoC4S MAX, even if you can avoid the build error, you will not be able to get out of the infinite loop.

 

MaMi_1205306_0-1659600517200.png

An infinite loop occurs when entering the "cyhal_pwm_start(&mclk_pwm)" function for some reason.

MaMi_1205306_2-1659600591962.png

Even if I comment out "cyhal_pwm_start(&mclk_pwm)" function, it stays in an infinite loop inside the "cyhal_i2s_enable_event(&i2s, CYHAL_I2S_ASYNC_TX_COMPLETE, CYHAL_ISR_PRIORITY_DEFAULT, true);" function.

MaMi_1205306_3-1659600843212.png

Regarding (2) in the previous question, it will be the buffer described in the processing in this "cyhal_i2s_enable_event(&i2s, CYHAL_I2S_ASYNC_TX_COMPLETE, CYHAL_ISR_PRIORITY_DEFAULT, true);" function.

 

I have a CY8CKIT-062-BLE demo kit, so I tried to run it on PSoC6, but I got a build error just by changing the BSP from "CY8CKIT-WIFI-BT" to "CY8CKIT-062-BLE".

Of course, if it is in the state of "CY8CKIT-WIFI-BT" before the change, you can build normally, but I do not have a demo kit, so I cannot confirm the operation.

Unlike PSoC Creator, HAL of ModusToolbox is so complex that you lose track of what you are looking for in the debugger.

I have a feeling something is wrong with this I2S HAL.

0 Likes