XFlash question: including data file with DFU upgrade

Technical questions regarding the XTC tools and programming with XMOS.
genap
Experienced Member
Posts: 99
Joined: Sat Aug 31, 2013 11:23 pm

Post by genap »

that is how i am trying to read flash data from an application:
(my application is based on a dj usb audio reference design)

In flash_interface.c I have functions

Code: Select all

int flash_init_exchange(void)
{
    DFUCustomFlashEnable();
    flash_cmd_enable_ports();

    return 0;
}

int flash_deinit_exchange(void)
{
    DFUCustomFlashDisable();
    flash_cmd_disable_ports();
    return 0;
}

void flash_read_exchange(unsigned int address, unsigned int amt, unsigned char flbuf[])
{
  fl_readData(address,amt,flbuf);
}
And this is a test function in application, reading 16 bytes from the first data partition sector:

Code: Select all

void front_flash_exchange(void)
{
  unsigned char fl_buffer[16];

  flash_init_exchange();
  flash_read_exchange(0x0000, 16, fl_buffer);
  Print_buffer(fl_buffer, 16);
  flash_deinit_exchange();
}
The front_flash_exchange() is executed first,
then flag is set and all the cores start executing.

The data reading works fine, but then an exception "Signal 'ET_ELLEGAL_RESOURCE' received" is
raised on ConfigAudioPorts() / configure_out_port().
Probably because audio ports are multiplexed with flash access ports.

I have no idea how to deal with this issue.


User avatar
Ross
XCore Expert
Posts: 972
Joined: Thu Dec 10, 2009 9:20 pm
Location: Bristol, UK

Post by Ross »

My guess is that configure_out_port is raising an exception as you have turned the port off inside flash_cmd_disable_ports();

On entry to ConfigAudioPorts() I would try making a call to set_port_use_on() for each port.
genap
Experienced Member
Posts: 99
Joined: Sat Aug 31, 2013 11:23 pm

Post by genap »

ok.
I've added the following to the audioports.xc:

Code: Select all

void ConfigAudioPorts(unsigned int divide) 
{
    set_port_use_on(p_lrclk);
    set_port_use_on(p_bclk);
    set_port_use_on(p_i2s_adc[0]);
    set_port_use_on(p_i2s_dac[0]);
It works!

Thank you so much, Ross.
User avatar
Ross
XCore Expert
Posts: 972
Joined: Thu Dec 10, 2009 9:20 pm
Location: Bristol, UK

Post by Ross »

genap wrote: Thank you so much, Ross.
No worries :)