XUF208 usb audio. Suspend after host PC reboot

Sub forums for various specialist XMOS applications. e.g. USB audio, motor control and robotics.
Post Reply
User avatar
maxssau
Member
Posts: 9
Joined: Mon Mar 18, 2019 8:35 am
Location: Russia, Samara
Contact:

XUF208 usb audio. Suspend after host PC reboot

Post by maxssau »

Hello!

XUF208 MCU, last USB audio SDK(6.15).

OS: Windows 10 x64, Ubuntu 18 x64.

I have a problem:

after reboot host PC, usb device suspend with error. if hardware reset usb device, it work good.

Code: Select all

tile[0] core[5]  (Suspended: Signal 'ET_ILLEGAL_RESOURCE' received. Description: Resource exception.)	
	3 XUD_Manager()  0x00046188	
	2 _Susb_audio_core_0.task.XUD_Manager.0() main.xc:325 0x00041ee5	
	1 __start_core()  0x00047610	

stack trace:

#0  0x00046188 in XUD_Manager ()
#1  0x00041ee5 in _Susb_audio_core_0.task.XUD_Manager.0 (frame=<value optimized out>) at C:/Projects/UI-01_sw1_hw1/module_usb_audio/main.xc:325
#2  0x00047610 in __start_core ()


part of main.xc

325:   XUD_Manager(c_xud_out, ENDPOINT_COUNT_OUT, c_xud_in, ENDPOINT_COUNT_IN,
                        c_sof, epTypeTableOut, epTypeTableIn, p_usb_rst,
                        clk, 1, XUD_SPEED_HS, XUD_PWR_CFG);
I try XSCOPE disable.

How fix it?


User avatar
maxssau
Member
Posts: 9
Joined: Mon Mar 18, 2019 8:35 am
Location: Russia, Samara
Contact:

Post by maxssau »

solution:

1. add to XN file:

Code: Select all

	<Nodes>
	<Node Id="2" Type="device:" RoutingId="0x8000">
	<Service Id="0" Proto="xscope_host_data(chanend c);">
	<Chanend Identifier="c" end="3"/>
	</Service>
	</Node>
	</Nodes>
	<Links>
	<Link Encoding="2wire" Delays="4,4" Flags="XSCOPE">
	<LinkEndpoint NodeId="0" Link="XL0"/>
	<LinkEndpoint NodeId="2" Chanend="1"/>
	</Link>
	</Links>
2. Ubuntu Usb core have bug, need disable autosuspend:

Code: Select all

root terminal:
echo -1 > /sys/bus/usb/devices/3-2/power/autosuspend
User avatar
mon2
XCore Legend
Posts: 1913
Joined: Thu Jun 10, 2010 11:43 am
Contact:

Post by mon2 »

Thank you for your resolution post.
Pcbindex
Newbie
Posts: 1
Joined: Thu May 03, 2018 6:59 am

Post by Pcbindex »

To figure out the accurate reasons or mechanisms why PCB loses the efficiency or is defective, we must follow the basic principle and analysis procedure, or important information may be omitted, which makes it impossible to continue to conclude the reasons for the mistakes or even the possibility. Generally, the basic procedures must be firstly based on efficiency failure to figure out the mode and place of efficiency failure, namely, failure location or malfunction location by collecting information, testing functions, electric performance test or some simple appearance inspection. For some simplified Cheap PCB Manufacturing or PCBA, it is very easy to locate the place of efficiency failure, whereas, for complex BGA or components or boards enclosed with MCM, defects are not easy to be observed by microscope. When this occurs, other aids may be adopted to figure it out. The next step is to make an analysis of the efficiency failure, that is, to make an analysis of the reasons for efficiency failure or mechanisms for defects in PCB with the aid of various chemical or physical methods., such as, insufficient welding, pollution, mechanical damage, moisture stress, medium corrosion, fatigue damage, CAF or particle transferring, over stress, etc..
User avatar
maxssau
Member
Posts: 9
Joined: Mon Mar 18, 2019 8:35 am
Location: Russia, Samara
Contact:

Post by maxssau »

addition to the solution:

add 2 files:

xuduser.c

Code: Select all

#include <platform.h>
#include <xs1_su.h>
#include "devicedefines.h"
#include "hostactive.h"
#include "audiostream.h"

#if 1
#include <hwtimer.h>
#include "interrupt.h"
hwtimer_t g_rebootTimer;


#pragma select handler
void HandleRebootTimeout(timer t)
{
    unsigned pll_ctrl_val;

    /* Reset device */
    read_sswitch_reg(get_local_tile_id(), 6, pll_ctrl_val);
    pll_ctrl_val &= 0x7FFFFFFF;
    write_sswitch_reg_no_ack(get_local_tile_id(), 6, pll_ctrl_val);
    while(1);
}

#define REBOOT_TIMEOUT 20000000

void XUD_UserSuspend(void)
{
    unsigned time;

    UserAudioStreamStop();
    UserHostActive(0);

    DISABLE_INTERRUPTS();

    asm volatile("setc res[%0], %1"::"r"(g_rebootTimer),"r"(XS1_SETC_COND_NONE));
    g_rebootTimer :> time;
    time += REBOOT_TIMEOUT;

    asm volatile("setd res[%0], %1"::"r"(g_rebootTimer),"r"(time));
    asm volatile("setc res[%0], %1"::"r"(g_rebootTimer),"r"(XS1_SETC_COND_AFTER));

    set_interrupt_handler(HandleRebootTimeout, 1, g_rebootTimer, 0)
}

void XUD_UserResume(void)
{
    unsigned config;

    /* Clear the reboot interrupt */
    DISABLE_INTERRUPTS();
    asm("edu res[%0]"::"r"(g_rebootTimer));

    asm("ldw %0, dp[g_currentConfig]" : "=r" (config):);

    if(config == 1)
    {
        UserHostActive(1);
    }
}

#endif
interrupt.c

Code: Select all

#if 1

#include <interrupt.h>

register_interrupt_handler(HandleRebootTimeout, 1, 200)

#endif
this not work with attached XTAG.
Post Reply