CY8CPROTO-062-4343W - USB Audio Device (FreeRTOS) demo

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

cross mob
ravo
Level 5
Level 5
10 likes received 5 comments on blog 5 solutions authored

Dears

I have CY8CPROTO-062-4343W connected to Pmod I2S2 module. Removed 0R resistors R72, R73, R74, R75 on kit (to disable sharing pins with UART)

I successfully compiled and programmed this demo, but after connecting USB cable to second connector J10 (to act as USB device). Windows 10 is unable to recognise the device. Error message "A request for the USB device descriptor failed."

Details from driver:

Device USB\VID_0000&PID_0002\5&d2dc547&0&1 was configured.

Driver Name: usb.inf
Class Guid: {36fc9e60-c465-11cf-8056-444553540000}
Driver Date: 06/21/2006
Driver Version: 10.0.19041.488
Driver Provider: Microsoft
Driver Section: BADDEVICE.Dev.NT
Driver Rank: 0xFF0000
Matching Device Id: USB\DEVICE_DESCRIPTOR_FAILURE
Outranked Drivers: usb.inf:USB\DEVICE_DESCRIPTOR_FAILURE:00FF2000
Device Updated: false
Parent Device: USB\ROOT_HUB30\4&1c182634&0&0

What can cause these problems ? I think that there could be possible some voltage drops, but I measured it and it looks that it is normal. But it looks that are some problems with initialisation of I2S. When I unplug the PMOD I2S2 module the "PSoC 6 USB Audio Device" is recognised by Windows 10 system correctly...

I have two CY8CPROTO-062-4343W kits (rev 06 and rev 08). I tested both of them on several PCs with same results.

Thanks in advance.

Radim

0 Likes
1 Solution
RodolfoGL
Employee
Employee
250 solutions authored 250 sign-ins 5 comments on KBA

Hello, I find the PWM clocking the audio codec adds too much noisy in the system. Dropping the "Drive Strength" of this pin (need to use PDL for this) can help a bit, but might not solve it totally.

If you can drop the MCLK frequency, it would help. But it would affect the audio sample rate. Might need to drop to 32 KHz or 24 KHz.

View solution in original post

20 Replies
Aashita_R
Moderator
Moderator
Moderator
50 likes received 100 solutions authored 250 replies posted

Hi @ravo ,

1. Can you please let me know your I2S connection? This will help us understand if anything is missed while making the connection of PMOD I2S2 with CY8CPROTO-062-4343W device.

2. If possible, can you attach your USB trace here so that we understand where exactly is the failure happening?

3. Can you try debugging your code and let us know if I2S initialisation is happening successfully or failing?

Please feel free to add here in case of any further clarifications.

Best Regards,

Aashita

 

0 Likes
lock attach
Attachments are accessible only for community members.
ravo
Level 5
Level 5
10 likes received 5 comments on blog 5 solutions authored

Dear Aashita,

thanks for answer. Here are more details:

1) I am using using I2S connection through J15 connector (2x6) on CY8CPROTO-062 board. I have connected PMOD I2S2 module from Digilent https://digilent.com/shop/pmod-i2s2-stereo-audio-input-and-output/

2) HTML log created using (USBlyzer tool) - see attachment USB AUDIO init error.html

3) I will try later and write back soon

Regards

Radim

0 Likes
ravo
Level 5
Level 5
10 likes received 5 comments on blog 5 solutions authored

Dear Aashita,

Here is small update after debugging demo project. I found that USB not recognised problem is potentially in capsense/touch related task. When I removed touch task and related initialisation part in main.c / audio_app.c. It seems to be working. And also I have found that demo if successfully connected/recognised USB device (which is very very occasional, when compiled with enabled touch task), then volume control popup windows is randomly showed and also volume level is changing, mute/unmute... so I suppose that all of these artefacts are related to capacitive touch implementation in demo project.

Radim

0 Likes
lock attach
Attachments are accessible only for community members.
ravo
Level 5
Level 5
10 likes received 5 comments on blog 5 solutions authored

Dear Aashita,

If I disable Capsense related initialisation commands in void audio_app_init function located in audio_app.c

/* Register and enable touch events */
touch_register_callback(audio_app_touch_events);
touch_enable_event(TOUCH_ALL, true);

... then USB audio device is recognized normally. I have look at Capsense Configurator and did not see what could be wrong. Normally capsense on these PROTO kits work without any problem.

Do you have some suggestions what could be wrong ?

Radim

0 Likes
Aashita_R
Moderator
Moderator
Moderator
50 likes received 100 solutions authored 250 replies posted

Hi @ravo ,

The capsense_settings.zip has only design.cycapsense file, which has dependency on design.modus of your project. Hence, I won't be able to fetch the information there.

Can you please attach your design.cycapsense , design.modus and also USB device configurations file here? This will help us check the issue.

Best Regards,

Aashita

 

0 Likes
lock attach
Attachments are accessible only for community members.
ravo
Level 5
Level 5
10 likes received 5 comments on blog 5 solutions authored

Dear Aashita,

I am attaching rather whole project in "USB_audio" folder. But you can also find requested files in separate folder "settings" which contain these files:

cyreservedresources.list
design.cycapsense
design.cyqspi
design.cyusbdev
design.modus

Regards

Radim

 

0 Likes
ravo
Level 5
Level 5
10 likes received 5 comments on blog 5 solutions authored

Dear Aashita

Have you got any update ? I did not find anything else what can cause these issues... As I wrote earlier If I disable Capsense related initialisation commands in void audio_app_init function it starts working.

I've got another problem with this demo wen I try to speedup CM4 core because I need more speed to do some audio processing. I tried to switch on FLL (setup 100MHz) and set CLK_HF0 to CLK_PATH0, CLK_PERI (divider 2) -> 50MHz. I correct  16 bit Divider 0 to adapt new PERI clock (Divider 1000 instead of 553) to generate 100kHz freq. The CM4 core and USB seems works ok. But I audio I2s is not working. I measure missing TX_SCK on P5.1, MCLK on P5.0 is present.

Can you please also investigate why switching FLL can cause I2S malfunction?

Thanks in advance.

Radim

 

0 Likes
Aashita_R
Moderator
Moderator
Moderator
50 likes received 100 solutions authored 250 replies posted

Hi @ravo ,

With your above added responses, there are a few things identified below -

  1. There is no need to remove the resistors, as long you don’t use the KitProg UART. The project should work like this.
  2. As discussed internally, the issue due to capsense was identified and reproduced. It was fixed by  increasing the USB interrupt priorities. In the usb_comm.c, set the USB interrupt priorities to 4 / 5 / 6, instead of 5 / 6 / 7 (high/medium/low). I will also file an internal ticket to keep track of the issue in next release of the code example.
  3. The reason this code example does not use the FLL is because we need to drive the MCLK out of a PWM. The MCLK needs to be in sync with the audio subsystem clock, which is driven by the CLK_HFCLK1. In this case, both are sourced by the same PLL.

If you could drive the MCLK out of CLK_HFCLK5, then you can free the PWM and use whichever frequency for the CLK_HF0 (including sourcing with FLL). However, this requires a change in the hardware. You need to write the P0.5 to the MCLK of PMOD. Then source the CLK_HFCLK5 and CLK_HFCLK1 from the same PLL.

Hope this helps!

Best Regards,

Aashita

ravo
Level 5
Level 5
10 likes received 5 comments on blog 5 solutions authored

Dear Aashita,

thanks for response.  Here are my comments:

1. I must remove resistor because I also would like use UART on kitprog but on different port (12.1 and 12.0) - this could be noted in example project. Now I have working I2S and UART at same time.

2. I changed desired priorities in usb_comm.c as you suggest, but it does not really help. Still same situation "USB device is not recognized..."

/* USB Interrupt Configuration */
const cy_stc_sysint_t usb_high_interrupt_cfg =
{
.intrsrc=(IRQn_Type) usb_interrupt_hi_IRQn,
.intrPriority = 4U,
};
const cy_stc_sysint_t usb_medium_interrupt_cfg =
{
.intrsrc=(IRQn_Type) usb_interrupt_med_IRQn,
.intrPriority = 5U,
};
const cy_stc_sysint_t usb_low_interrupt_cfg =
{
.intrsrc=(IRQn_Type) usb_interrupt_lo_IRQn,
.intrPriority = 6U,
};

Are there anything else which need to be modified in source code ?

3. Regarding clock setting I have found some workaround (Use FLL for USB clock, and add PLL1 with 110.67 MHz as source for CLK_HF0 (as possible to close to 2x 55.296 MHz - PLL0) and than CLK_PERI with divider 2 than it looks working.

ravo_0-1651754434411.png

But I would like to have CLK_HF0 independent on ext crystal to be able to run core M4 for 150 MHz

Regards

Radim

 

0 Likes
ravo
Level 5
Level 5
10 likes received 5 comments on blog 5 solutions authored

Dear 

0 Likes
ravo
Level 5
Level 5
10 likes received 5 comments on blog 5 solutions authored

Dear  do you have some news, could you please update the thread ?

I am still not able to use CY8CPROTO-062-4343W with USB Audio Device (FreeRTOS) demo and CAPSENSE buttons.

Regards

Radim

0 Likes
lock attach
Attachments are accessible only for community members.
RodolfoGL
Employee
Employee
250 solutions authored 250 sign-ins 5 comments on KBA

Hi Radim,

There is a race condition between the touch task and the USB task. Depending on the conditions, the touch might try to send USB packet without having the device enumerated, which causes the error you are seeing. I used a mutex to avoid such race condition.

I also find the slider unstable. I changed a bit the code. Instead to slide your finger, you just need to keep it press on the right or left side. Attach you find a new project, see if this fixes your issues.

ravo
Level 5
Level 5
10 likes received 5 comments on blog 5 solutions authored

Dear Rodolfo,

thanks for response and sending update project. But I am not able to open or import in Modus Toolbox IDE. Can you help with this ?

Radim

 

0 Likes
RodolfoGL
Employee
Employee
250 solutions authored 250 sign-ins 5 comments on KBA

Just overwrite the source folder after you created the mtb-example-psoc6-usb-audio-device-freertos using project-creator. Everything else should be the same. 

0 Likes
ravo
Level 5
Level 5
10 likes received 5 comments on blog 5 solutions authored

Dear Rodolfo,

thanks for this code... I tried this, USB audio seems working now. But capsense slider (volume control task) still did not work. Maybe I did not correct understand your meaning: "Instead to slide your finger, you just need to keep it press on the right or left side" I tried this but nothing changed...

Regards

Radim

0 Likes
RodolfoGL
Employee
Employee
250 solutions authored 250 sign-ins 5 comments on KBA

Yes, keep your finger on the slider for a few seconds.

Is the CapSense buttons working for you? Note you need to play a video or music using a software that support HID commands, such as Windows Player.

0 Likes
ravo
Level 5
Level 5
10 likes received 5 comments on blog 5 solutions authored

I tried to play some audio using Windows Media Player or Spotify in Web but only I got working button for play/pause action. If I download standalone cap-sense demo, all buttons and slider works ok.

Update 1:

I found that I can only change volume when playing is stopped / paused. If something is played than Volume control did not work ... (of course also using windows taskbar volume control...) If I pause ... than both work.

But sometimes volume randomly goes down to silent... and marked as no sound icon (x). But maybe it was due bad capsense work...

Update 2: If volume control is changed using capsense slider or Windows control (I mus note that capsense slider only work when Audio is paused) than the audio volume is not changed, even if Control show muted than sound level is still same.

ravo_0-1663941023911.png ravo_3-1663941254583.png

Radim

0 Likes
RodolfoGL
Employee
Employee
250 solutions authored 250 sign-ins 5 comments on KBA

Hello, I find the PWM clocking the audio codec adds too much noisy in the system. Dropping the "Drive Strength" of this pin (need to use PDL for this) can help a bit, but might not solve it totally.

If you can drop the MCLK frequency, it would help. But it would affect the audio sample rate. Might need to drop to 32 KHz or 24 KHz.

ravo
Level 5
Level 5
10 likes received 5 comments on blog 5 solutions authored

Dear RodolfoGL, thanks for answer and also for more details about these issues.  I am not able to drop MCLK frequency, because I also do some audio processing on 16kHz sample audio. I am still searching another way to correct function of this project. I am quite disappointed of quality of this example project which is malfunction. I hope that I find in near future some workaround.

Regards

Radim

0 Likes
ravo
Level 5
Level 5
10 likes received 5 comments on blog 5 solutions authored

Dear RodolfoGL,

When will be updated demo code for USB Audio Device (FreeRTOS) demo  ?

I still have artefacts with capsense control on this PROTO kit

Thanks in advance and Regards

Radim

0 Likes