Ok narrowed down my problem with Tools

Technical questions regarding the XTC tools and programming with XMOS.
User avatar
Wavelength
Experienced Member
Posts: 76
Joined: Mon Sep 24, 2018 9:56 pm

Ok narrowed down my problem with Tools

Post by Wavelength »

All,

Still struggling to get my project back on track. I know there is a lot of rambling on my part with this problem but I think I have narrowed it down.

So this is a UAC2 project XU208, I2S, I2C (single bit-working). I have customdefines.h included in the devicedefines.h at the top of the file. In customdefines.h I have the obvious following for UAC2

/* Audio class version to run in - Default is 2.0 */
#ifndef AUDIO_CLASS
#define AUDIO_CLASS (2)
#endif

#define U208_ONLY 1 // XU208

Problem is in main.xc the following happens Full Speed not High Speed is selected here and the U208_ONLY ifdef is also ignored. So basically the entire compile is for some reason falling back to the defaults in devicedefines.h which makes no sense to me.

So I did the following in main.xc

#define U208_ONLY
#define AUDIO_CLASS 2

#ifdef U208_ONLY
set_core_high_priority_on();
#endif
/* USB Interface Core */
#if (AUDIO_CLASS==2)
uac_check(2);
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);
#else
uac_check(1);
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_FS, XUD_PWR_CFG);
#endif

~~~ of course that worked but really it's not going to work because the entire project needs to see the AUDIO_CLASS declaration. I know the U208_ONLY probably doesn't need to be there I am shooting in the dark now.

Anyway, when I do the above I get the following redeclarations after I make the project:

'AUDIO_CLASS' macro redefined app_usb_aud_xu208_xhra line 329, external location: /Users/gordonrankin/XMOS3x/X3UAC2/sc_usb_audio/module_usb_audio/main.xc C/C++ Problem
'U208_ONLY' macro redefined app_usb_aud_xu208_xhra line 328, external location: /Users/gordonrankin/XMOS3x/X3UAC2/sc_usb_audio/module_usb_audio/main.xc C/C++ Problem

Ok so I figure it must be picking up the devicedefines.h default stuff and not my customdefines for some reason so I just delete the 208_ONLY ref and place the following in main.xc instead for AUDIO_CLASS

/* Audio class version to run in - Default is 2.0 */
#ifndef AUDIO_CLASS
#define AUDIO_CLASS (2)
#endif

Figuring it would then default to UAC (Full Speed) instead of UAC2 (High Speed). Well it didn't.... it selected UAC2 High Speed.

Anyone know what is going on here? Obviously no answer from XMOS.

Thanks,
Gordon


Wavelength Audio, ltd.
User avatar
mon2
XCore Legend
Posts: 1913
Joined: Thu Jun 10, 2010 11:43 am

Post by mon2 »

You have more patience than I. By now, would have low level triple formatted the drive and called in a local priest...

can you locate every file in your project with the name devicedefines.h and just rename to devicedefines_notworking.h or similar to see if an error is raised. That is, exclude the header file(s) you believe are causing this issue. Once the toolchain starts to complain about the missing header file, then you can hopefully nail down which and when the file is being applied by your compiler.
User avatar
Wavelength
Experienced Member
Posts: 76
Joined: Mon Sep 24, 2018 9:56 pm

Post by Wavelength »

Mon2, BTW I did create a Win10 machine from scratch with a NUCi7, 1TSSD and the same problem exists. Thought I am going to go back to that one and checkout more but here is the macOS weirdness continued:

Yesterday I looked into the defaultdefines.h as I was just going to back that up then delete everything in that file except for the include customdefines.h.

So everyone knows this statement....

#ifndef _DEVICEDEFINES_H_
#define _DEVICEDEFINES_H_

Ok then there is suppose to be an #endif at the bottom of the file so the damn thing doesn't get included more than one time.

Well there was no #endif in the file. So I went down and grouped all the ifdefs and found a lost endif with no matching ifdef here:

/* Audio Unit ID defines */
#define FU_USBIN 11 /* Feature Unit: USB Audio device -> host */
#define FU_USBOUT 10 /* Feature Unit: USB Audio host -> device*/
#define ID_IT_USB 2 /* Input terminal: USB streaming */
#define ID_IT_AUD 1 /* Input terminal: Analogue input */
#define ID_OT_USB 22 /* Output terminal: USB streaming */
#define ID_OT_AUD 20 /* Output terminal: Analogue output */

#define ID_CLKSEL 40 /* Clock selector ID */
#define ID_CLKSRC_INT 41 /* Clock source ID (internal) */
#define ID_CLKSRC_SPDIF 42 /* Clock source ID (external) */
#define ID_CLKSRC_ADAT 43 /* Clock source ID (external) */

#define ID_XU_MIXSEL 50
#define ID_XU_OUT 51
#define ID_XU_IN 52

#define ID_MIXER_1 60

/* Defines for DFU */
#define DFU_PID PID_AUDIO_2
#define DFU_VENDOR_ID VENDOR_ID
#define DFU_BCD_DEVICE BCD_DEVICE
#define DFU_MANUFACTURER_STR_INDEX offsetof(StringDescTable_t, vendorStr)/sizeof(char *)
#define DFU_PRODUCT_STR_INDEX offsetof(StringDescTable_t, productStr_Audio2)/sizeof(char *)
#endif

~~~ so everything below this is probably getting ignored.

Anyway figuring somehow I screwed this up I downloaded the code again this morning and the two files are the same.

Ok next step, lets delete everything in the devicedefines.h and leave the shell with the customdefines.h.... Oh great it's crashing again!!!!

#ifndef _DEVICEDEFINES_H_
#define _DEVICEDEFINES_H_

#include "customdefines.h"

#endif

Entire file... ok 5 errors all DFU defaults, 1 infos about the flash.h, 29 warnings-4 DFU, 1 midi, the rest:

Invalid project path: Include path not found (module_yyy). app_usb_aud_xu208_xhra pathentry Path Entry Problem

But still the big problem is even with all that stuff gone. Main.xc is still defaulting to UAC instead of UAC2???

Ok more later on Windoz

Thanks,
Gordon
Wavelength Audio, ltd.