AN01027 i2c issue Topic is solved

If you have a simple question and just want an answer.
__BriKs__
Active Member
Posts: 39
Joined: Tue Nov 27, 2018 9:45 pm

AN01027 i2c issue

Postby __BriKs__ » Fri May 22, 2020 10:10 pm

Hello,

Using the application note AN01027 with a custom hardware I've a lot of compiling errors due to i2c.
Purpose is to adapt the xmos audio reference project to a custom hw using a XUF208 256 TQ64 chip.
I use a TI PCM1792A DAC (conf with i2c) and my schema is based upon Xmos audio plateforme with CS2100 and PL611.
The device is a audio amplifier with dac and SPDIF and USB as digital input.

I follow the an and it don't compilen then I search on forum and found severals trick to reach the build complete.
I'm stick on I2C issue that port are note defined but i didn't found where to define i2c ports in the project.

I define ports on xn files but xn files didn't mention about scl or sda ports, just a general i2c port ?
My design use i2c connected on XOD14 (SCL) and XOD16 (SDA) then i try to use port 8B without sucess

Can you help me founding where the physical i2c ports are defined inside project ?
Also can you help me for those who have use AN01027 where are defined physical pin for signals MCLK_FSEL, PLL_SELECT and DAC_RST_N ?

Attached my projects (icall brixamp instead of app_usb_aud_custom_XU208_HW and i had to add i2c.h and i2cshared.h in brixamp project because compiler ask for them) and a view of my design

Thanks for help
You do not have the required permissions to view the files attached to this post.
View Solution
User avatar
mon2
XCore Legend
Posts: 1829
Joined: Thu Jun 10, 2010 11:43 am

Postby mon2 » Fri May 22, 2020 10:30 pm

Hello. Can you review this thread to see if it helps to fix your compiler errors?

viewtopic.php?f=26&t=7772&p=37097&hilit=XHRA#p37097

Post back if it does not.

Also, for I2C bus use, best if you can consider SINGLE BIT ports so that the software can deal with the SDA and SCL independently. On the XMOS CPU, in general, ALL port pins on a block of pins must operate in the same direction. So this means if you have a 8 bit port (8B) then ALL pins 8B0..8B7 must be in output mode OR all in input mode.

Using a common block of port pins is not practical for I2C bus use.

So track down some free SINGLE bit ports (ie. 1H0; 1F0; etc. - just some random examples).

If your posted schematic matches the XMOS ref designs then most likely the IP is making use of the 8B as 2 groups of 4B pins for I2C.

Specifically, using 4C0 for I2C_SCL (X0D14) and 4D0 for I2C_SDA (X0D16). That is, 4C port block can operate independent of the 4D block of I/O pins so I2C could work here.

Do you have the schematic for your power supply for a quick review?

Hope this helps.
__BriKs__
Active Member
Posts: 39
Joined: Tue Nov 27, 2018 9:45 pm

Postby __BriKs__ » Fri May 22, 2020 11:33 pm

Hello,

Will review the mentioned thread.
Yes I can use 4D and 4B ports instead of single 8B, anyway I will need to locate where I can specify pin port mapping, that's the point I'm locked in.

My design works, in the way I can debug with a XTAG3 debuger, the voltage rise correctly in less than 10ms between 1V and 3.3V.

Warning, just saw I post a bad version of Xmos sheet, there is issues in the first schematic I post (pin 53 and 54 of Xmos connected together, 100nF caps on CT pin of NCP308 reset supervisor must be not mount and USB line consideration).
Then I post also an updated schemtic of Xmos implementation.

Thanks for help :) I'm a single man not an company, purpose is to set up a company if this amp works great.
You do not have the required permissions to view the files attached to this post.
__BriKs__
Active Member
Posts: 39
Joined: Tue Nov 27, 2018 9:45 pm

Postby __BriKs__ » Sat May 23, 2020 6:07 pm

Hello,

Following the advices from mon2 I try on another win 7 PC (I used a win10 pc).
Then I use files provided as sw_usb_audio-[sw]_6.15.2rc1 and now the build completion is almost done!
just few things errors at the end of the builds:

xcc: unrecognized option `-'
Compiling xc_ptr.xc
xcc: unrecognized option `-'
Compiling usb_device.xc
xcc: unrecognized option `-'
Compiling usb_std_requests.xc
xcc: unrecognized option `-'
Compiling XUD_EpFunctions.xc
xcc: unrecognized option `-'
Compiling XUD_Ports.xc
xcc: unrecognized option `-'
Compiling write_sswitch_reg_blind.S
xcc: unrecognized option `-'
Compiling lock.S
xcc: unrecognized option `-'
Compiling fastmix.S
xcc: unrecognized option `-'
Compiling XUD_EpFuncs.S
xcc: unrecognized option `-'
Compiling swlock_asm.S
xcc: unrecognized option `-'
Rebuild .build/_obj.rsp
Creating BriXamp.xe
flashlib_user.c: Error: Undefined reference to 'fl_connect'
flash_interface.c: Error: Undefined reference to 'fl_deleteImage'
flashlib_user.c: Error: Undefined reference to 'fl_disconnect'
flash_interface.c: Error: Undefined reference to 'fl_endWriteImage'
flash_interface.c: Error: Undefined reference to 'fl_getFactoryImage'
flash_interface.c: Error: Undefined reference to 'fl_getNextBootImage'
flash_interface.c: Error: Undefined reference to 'fl_readImagePage'
flash_interface.c: Error: Undefined reference to 'fl_setProtection'
flash_interface.c: Error: Undefined reference to 'fl_startImageAdd'
flash_interface.c: Error: Undefined reference to 'fl_startImageRead'
flash_interface.c: Error: Undefined reference to 'fl_writeImagePage'
xcc: unrecognized option `-'
xmake[1]: *** [bin//BriXamp.xe] Error 1
xmake: *** [bin//BriXamp.xe] Error 2

18:50:01 Build Finished (took 47s.50ms)

The flashlib didn't build, i don't know what is it ?

Also I didn't sucessfull pass all the module in the makefile, when I split module list (because too long xtime can't manage it) with return and space xtime give me this:

18:55:37 **** Incremental Build of configuration Default for project BriXamp ****
xmake CONFIG=Default all
Makefile:13: *** missing separator. Stop.

18:55:37 Build Finished (took 112ms)

I try without space and only a return with same error. Then I use makefile provided on files for xhra to xu208 with less module but maybe the builds errors come from that ?

I wana add the list of module inside AN01027 but I don't know how to do:
USED_MODULES = module_adat_rx module_adat_tx module_dfu module_i2c_shared module_i2c_single_port
,! module_spdif_rx module_spdif_tx module_usb_audio module_usb_device module_usb_midi module_usb_shared
,! module_xud

I post my project with less module on makefile.

Sorry for such basic questions, my natural langage is iron solder nor C.
You do not have the required permissions to view the files attached to this post.
User avatar
mon2
XCore Legend
Posts: 1829
Joined: Thu Jun 10, 2010 11:43 am

Postby mon2 » Sun May 24, 2020 5:42 pm

Sorry, I should have been more clear - please review the procedure posted by akp.

xmos_audio_compile_procedure.png
You do not have the required permissions to view the files attached to this post.
__BriKs__
Active Member
Posts: 39
Joined: Tue Nov 27, 2018 9:45 pm

Postby __BriKs__ » Sun May 24, 2020 10:50 pm

Hello, indeed after reviewing full post I found another silly forget from mine, the -DQUAD_SPI_FLASH=1 flag!
Then with the flag project build!
But USB don't enumerate then I'm trying to port the USB HID mouse example into my bord to check if usb is working or not in my design, so I'm fighting with building errors to port hid example in my design.

I think I can avoid basic training (programming guide, xtime composer documentations) because I want just to make some integrations works but seems my skill with firmware is not enough to skeep these trainings.

Anyway many thanks for helping me!
User avatar
mon2
XCore Legend
Posts: 1829
Joined: Thu Jun 10, 2010 11:43 am

Postby mon2 » Sun May 24, 2020 11:28 pm

@_BriKs_, don't stop learning. Too often, the disappointment of not working will be deep and you may not return back. Speaking from personal experience. This industry is plagued with the rat race of "just get the product out and we can work on the bug fixes later" attitude. This leads to broken tools and broken products. We are constantly reporting issues to large semiconductor firms of bugs that were not caught even after years after their release.

On the XMOS Mouse HID - that is a good one to learn from and test on your board.

Here is a quick way to import an launch this example.

1) launch your toolchain -> create a fresh workspace (ie. 05242020 sounds good).

2) IDE -> see the EXAMPLES ICON on the LEFT pane -> select it -> then type HID on the search bar and you should see the AN00129.

Double click to import into your workspace. Select FINISH. Project -> Build ALL. You will see some errors but they will auto-resolve all except one. The LIB_XASSERT will not - do not know why other than to cause irritation. Why not just have perfection? In another life perhaps...

See the attached screens on how to compile and resolve the raised quirk.

BTW - this is an excellent tool to stress your hardware @ USB High Speed (480 Mbps) using the Mouse HID model. If successful, your mouse pointer will move in a square pattern repeatedly till stopped. Suggest that you run it for a long time to see if the mouse pointer movement is erratic or loses the pattern, etc. to denote possible signal integrity issues. USB layout should be on 4L or more with proper impedance control of the PCB traces @ 90 ohms. There are many articles on this topic on the internet. We have many High Speed USB designs (and tons of PCIe designs which are faster yet) without issues on 4L FR4.

See attached screen grabs for possible assistance. Now the next post should be a positive success story that the compiler worked. Honestly the tools are out there but have to invest (too much) time to locate this fix or that to make then behave. For now, I recall some of the tricks :)

Post back with your results..will check later for your good news.
You do not have the required permissions to view the files attached to this post.
__BriKs__
Active Member
Posts: 39
Joined: Tue Nov 27, 2018 9:45 pm

Postby __BriKs__ » Mon May 25, 2020 11:42 am

Dear mon2,

I really appreciate your encouragment and indeed I share your opinion about poor quality software even hardware those day... Also these enable low price of course.
I will not give up, 3 years now I work on my amp, off time after my job and especially those days with time allowed by covid-19.

I'm certain I've less experience than you (12 years on industrial electronic as hw engineer) but I've learned that sucess is always at RDV when we never give up.

Then I move back to another PC (windows 10) and on it usb hid mouse build :)
But mouse didn't move and usb don't enumerate :/
Programm execution is locked on a line (Test for RESET/SUSPEND exception) (screenshgot attached).

My layout was made with best practice (4L, differential pair routing for d+/d- with minimal skew between them) I don't ask PCB manufacturer for control impedance, my plan is to route the pair using manufactrurer data to, by construction, match the 90R diff impedance. I used to work like that for relative low speed digital signal like USB HS, off course didn't do that for DDR or PCIE routing.

I think my pcb work, as one time I see a windows notification as 'USB device not recognised' when I test USB audio application, in fact at this time I have TVS on USB lines with a way too much capacitance, then I remove the TVS and try to get the state when windows told me USB device not recognised (I dont use tools such git to work :/ )

So I focus on making work usb HID, for now nothing appends from the host side and when I stop programm execution this is alxays the same line.
You do not have the required permissions to view the files attached to this post.
User avatar
mon2
XCore Legend
Posts: 1829
Joined: Thu Jun 10, 2010 11:43 am

Postby mon2 » Mon May 25, 2020 12:04 pm

Hi.

1) do you have an official kit from Xmos? Can you test the same IP on the official kit? Does it work there?

2) what does windows device manager show with your custom PCB and this IP? Yellow marked device?

3) have you confirmed that your custom Xmos pcb work with a simple LED blinky IP? So every time you power up, this custom PCB will blink / pulse a gpio pin at 1hz or similar.

4) do try to ground the #Reset line with a jumper and then release. The #Reset line should be pulled up to a high during normal use. The reset supervisor is open drain so pulling it low with an external wire is permitted and safe. Be sure the reset supervisor device in circuit is NOT push-pull type output before testing.

Will review your power sequencing upon reaching the office but that is important.

If the IP works on the XMOS kit then so should your PCBA.

5) confirm the 24mhz clock to the CPU is working. That is the only clock required for this USB hid IP. This and valid voltage rails and power sequencing. For now do not worry about USB impedance control. Have feedback from Xmos group that the USB PHY is quite resilient.

6) be sure the value of Rtune is correct and present. This resistor value is a common issue and also the proper soldering of the XMOS CPU.

Please share your updates.

Thanks.
__BriKs__
Active Member
Posts: 39
Joined: Tue Nov 27, 2018 9:45 pm

Postby __BriKs__ » Mon May 25, 2020 2:16 pm

Hello,
1-not unfortunately despite the low price still too expensive for me
2-nothing
3-not confirmed with a blinky led, but confirmed with hello world with Xtime composer 14.4.1, I can download into flash, debug, add break point and so...
4-NCP308 I use is open drain, I made some screenshoot atached, the first is 3V and 1V, the second is 1V and NRESET (my scope is only 2ch), note here I have more than 10ms between 1V stabilisation and release of reset I thinks it's OK because my design is self powered ?
5-24MHz is present, I use my limited bandwith scope to measure it, I see a almost sinusoidal @ 24MHz 3.3V then I measure with the scope other 24Mhz on the design I'm confident about and the result was the same (sinoid instead of square) so I conclude sinusoid is due to my scope bandwith
6 Rtune =43.2R in my design and present. I add also two of this 43.2R 603 resistor in serie with USB lines, I test replace with 0R no change.

Also I rework manually the solder to be certain and with a magnifying glass seems correct.

Note: The NRESET signal is generated with NCP308, the NCP308 own a manual reset input which is the one I use for JTAG header of XMOS, but this manual reset is also linked to a GPIO of my main CPU (STM32) in order I can reset the XMOS in case of faillure, off course today the STM32 pin is configured as high impedance input in order to leave XTAG3 well working.
I also attach the layout side with XMOS.

Note: I measure about 4.3V at the 10KR (R602) resistor between XMOS VBUS input and USB connector, other side of resistor is 5V, this lead to a current about 70µA leaked by PIN23 USB_VBUS of XMOS, looks reasonable.
You do not have the required permissions to view the files attached to this post.

Who is online

Users browsing this forum: No registered users and 3 guests