RT1015 USB SAI Examples issues

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

RT1015 USB SAI Examples issues

1,504 Views
anton_glukhov
Contributor III

Hi,

I ordered RT1015 EVK board and trying to compile usb_device_audio_speaker and other usb_device_* projects from SDK 2.7, but unfortunately I cannot run them. I compile with GCC7.3 and GCC8.2 and upload them via MSD. I tried both bm and freertos versions, but it seems that USB init fails or unstable. For example, on OSX machine USB doesn't init at all and I don't see any errors in dmesg logs, but on the Linux machine, I could connect it a few times and it initialized USB audio sound card, but it was unstable and failed after a while. Also, I tried with another RT1015 EVK board(I ordered three boards), but the result is the same. I'm not sure, maybe I have to set some jumper or something else. Also tested with different USB wires, ports, etc. For some USB examples I see errors during USB stack init, e.g. "USB device mouse failed", "USB device HID generic failed", etc. For audio speaker example, I see only "Init Audio SAI and CODEC" and nothing more. Unplug/plug USB connector doesn't help.

I have RT1011 EVK kit and compiled all these examples with the same SDK version(but generated for RT1010 MCU) and it works and all USB audio examples work quite stable.

Also, I can't find any schematics for RT1015EVK board or description of all jumpers on the board. Only one thing from readme.pdf that I noticed - "Set the hardware jumpers (Tower system/base module) to default settings.".

Please, let me know if I missed something in the configuration or if you have any suggestion for my case.

Thanks!

Labels (1)
Tags (1)
0 Kudos
10 Replies

1,228 Views
anton_glukhov
Contributor III

Additinal issue occurs with usb_device_audio_speaker for both RT1015 and RT1010 boards. Debug build shows current error:

Init Audio SAI and CODEC
ASSERT ERROR " false ": file "/Users/anton/Source/mcuxpresso/mcuxpresso_v2_6_0_RT1010/devices/MIMXRT1011/drivers/fsl_lpi2c.c" Line "168" function name "LPI2C_GetInstance"

And additional printf output in LPI2C_GetInstance function with addresses:

kLpi2cBases[instance]: 0x0
base: 0x76697244
kLpi2cBases[instance]: 0x401a4000
base: 0x76697244
kLpi2cBases[instance]: 0x401a8000
base: 0x76697244

Best regards,

Anton

0 Kudos

1,228 Views
FelipeGarcia
NXP Employee
NXP Employee

Hello Anton,

 

As you mentioned, it is really hard to tell what the issue could be here.

 

It is recommend that you use the MCUXpresso IDE (MCUXpresso IDE|NXP ) with the MCUXPresso SDK (Welcome to MCUXpresso | MCUXpresso Config Tools ) that way you get everything and you don't have to worry about all the parts and all the setup. There are some tutorials of GCC compiling (check links below) but again I recommend this only if you have very special needs. If you get the MCUXpresso IDE, you will have something working and a solid base.

 

Tutorial: MCUXpresso SDK with Linux, Part 1: Installation and Build with Make 

Tutorial: MCUXpresso SDK with Linux, Part 2: Commandline Debugging with GDB 

https://community.nxp.com/community/mcuxpresso/mcuxpresso-sdk/blog/2019/05/20/tutorial-mcuxpresso-sd... 

Hope this helps.

 

Best regards,

Felipe

0 Kudos

1,228 Views
anton_glukhov
Contributor III

Hello Felipe,

Thank you for your support!

I already did this experiment with MCUXpresso, and that's interesting because the original issue is not reproducible with MCUXpresso. However, there are still some problems with boards or settings with the build.

So, I install the last version MCUXpresso. I have one RT1010 EVK and 3 RT1015 EVK boards. Because of this, I imported a few projects for RT1010(RT1011) and a few projects for RT1015, including USB examples with audio speaker. RT1010 board works as expected without any issues, thus I could compile, run, debug any project from examples, and, of course, I tested USB audio, and it works with any OS perfectly. However, when I compile the same project(audio speaker) for RT1015 and run it USB stack initialised correctly and I hear the sound for about 3-5 seconds after this sound disappears. I thought, maybe the problem with a board and tried with all three boards(RT1015 EVK) the same example, but results are identical. I also tried with different OSs(Linux, Osx) and the same. So it plays for a few seconds and then silence, but it respond for volume change and mute toggling, that is, I see active logging in the serial terminal.

So, now, after I tried with MCUXpresso it seems that codec disables output after a few seconds or DMA stops processing or something else. Could I forget something or maybe you have already seen similar issue?

Best regards,

Anton

0 Kudos

1,228 Views
FelipeGarcia
NXP Employee
NXP Employee

Hi Anton,

 

Are you referring to dev_audio_speaker USB examples? I tried baremetal and FreeRTOS examples and both worked correctly on my side. Could you please confirm the examples you are working on?

 

In addition, you mentioned after 3-4 seconds the sound disappears. In this case, the USB is still enumerated in your PC?

 

Best regards,

Felipe

0 Kudos

1,228 Views
anton_glukhov
Contributor III

Hi Felipe,

Thank you for help!

It seems that I found the problem. The USB unstable with USB hub that I use. I have Macbook Pro with USB-C ports, and I use external USB hub QacQoc. Moreover, after this hub I have another hub with 7 ports:

https://www.amazon.de/Tumao-Netzteil-Datenhub-unabh%C3%A4ngige-Ladeger%C3%A4t/dp/B072KK7GP8/ref=sr_1... 

So, in the end I tried with direct connect(without any hubs), but only USB-C to USB-A wire. Now audio processing is stable and USB is stable. If I use any of the mentioned hubs, then USB is not stable but initialized(enumerated) correctly. However, no audio output and if I change the volume it's lagginsh and glitching and no audio output.

I think It's interesting to investigate it, because the main purpose of this chip for me is audio processing, and if it works unstable with many hubs then It is a bit risky here.

During the tests, I also tried different USB wires and use only one USB hub and two hubs in the chain. Both hubs support USB 3.0, but as far as I understand they should be back-compatible.

Could you quickly test it with some usb hubs and with any Macbook if it's possible?

The boards I have are: 2018 NXP B. V., 700-38830 Rev A, SCH-38830 Rev B

Also, I have very short question about control volume on the device and automatically update it via USB on the host. If I have two buttons (vol up, vol down) and would like to change the volume on the board, but it's not clear how to update it on the host. Have you got any example that supports changing parameters from the board?

Thank you!

Best regards,

Anton

0 Kudos

1,228 Views
FelipeGarcia
NXP Employee
NXP Employee

Hi Anton,

 

Unfortunately, I do not have a MacBook PC on my side to do the tests you mentioned.

 

Regarding the volume update, it is true that the example works at a fixed volume. However, you can modify that in USB_AudioCodecTask. If you debug the program, you will see that VOLUME_CHANGE_TASK is already called when you change the volume of your PC, however, that only prints the value through UART interface.

 

You will need to called this HAL_CODEC_SetVolume function as follows. Please keep in mind that volume value, support 0 ~ 100, 0 is mute, 100 is the maximum volume value. You will need to implement your own logic here.

    if (g_UsbDeviceAudioSpeaker.codecTask & VOLUME_CHANGE_TASK)
    {
#if USBCFG_AUDIO_CLASS_2_0
        usb_echo("Set Cur Volume : %x\r\n",
                 (uint16_t)(g_UsbDeviceAudioSpeaker.curVolume20[1] << 8U) | g_UsbDeviceAudioSpeaker.curVolume20[0]);
#else
        usb_echo("Set Cur Volume : %x\r\n",
                 (uint16_t)(g_UsbDeviceAudioSpeaker.curVolume[1] << 8U) | g_UsbDeviceAudioSpeaker.curVolume[0]);
#endif
        HAL_CODEC_SetVolume(&codecHandle, kWM8960_HeadphoneLeft, volume);
        g_UsbDeviceAudioSpeaker.codecTask &= ~VOLUME_CHANGE_TASK;
    }‍‍‍‍‍‍‍‍‍‍‍‍

Hope it helps!

 

Best regards,

Felipe

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

1,228 Views
anton_glukhov
Contributor III

Hi Felipe,

thank you for the support!

Yes, that's clear, but I meant to change the volume on the host(on the PC). Let's say I have two buttons on the board, so I press one to change vol+ and the second one for vol-. By pressing these buttons I can easily change the volume by sending the command to the codec, but I cannot update the volume value on the PC to synchronize it. That means that the volume level on the PC is not changing. I don't know how to send USB commands from the board to PC. That should be some sort of USB IN packet or so.

Thank you!

0 Kudos

1,228 Views
FelipeGarcia
NXP Employee
NXP Employee

The API to send data through a specified endpoint is USB_DeviceAudioSend. However, the example works with events received by the host as you can see in USB_DeviceAudioRequest. The scenario you have proposed is not supported by the stack, you will need to implement this yourself.

 

Best regards,

Felipe

0 Kudos

1,228 Views
FelipeGarcia
NXP Employee
NXP Employee

Hi Anton,

 

I tried to load same example (usb_device_audio_speaker) in my i.MX RT1015 EVK using MCUXpresso and I was able to run the example for a few minutes without any issue.

 

My jumper settings were the same as below:

pastedImage_1.png

In addition, you can find the schematics of the board in this link.

 

Best regards,

Felipe

0 Kudos

1,228 Views
anton_glukhov
Contributor III

Hi Felipe,

thank you very much for your support!

I quickly investigated with gdb what happens with the application(flexspi_nor_release/dev_audio_speaker_freertos.elf, SDK version 2.7). Compilation with GCC 8.3.1 20190703 on linux machine with build_all.sh script.

After the start I see the log "Init Audio SAI and CODEC", but nothing more. Then I connected to the board with openocd/gdb, load the elf file, reset the board from gdb and check backtrace. Here is backtrace:

Program received signal SIGINT, Interrupt.
0x6000254a in HardFault_Handler ()
(gdb) bt
#0 0x6000254a in HardFault_Handler ()
#1 <signal handler called>
#2 0x60006734 in prvPortStartFirstTask ()
#3 0x6000680e in xPortStartScheduler ()
#4 0xf0a049fc in ?? ()

It seems that scheduler fails during the first task start. Maybe issues with timers or memory. It's hard to tell.

I also tried to run bm RAM version with direct loading to 0x0 address(ITCM) with following openocd and it works:

proc exec_from_ram {image_name} {
   init
   dap init
  reset halt
   load_image $image_name
   mem2array stack_reset 32 0x00000000 2
   reg sp $stack_reset(0)
   resume $stack_reset(1)
   shutdown
  }

So, it's hard to tell, maybe I upload the image with a wrong way, or maybe another issue. Any suggestions how can I investigate it with more details?

Thanks!

Best regards,

Anton

0 Kudos