Reading GPIOs
-
- XCore Addict
- Posts: 189
- Joined: Tue Jan 17, 2017 9:25 pm
When I take out all i2c stuff out and move it back to port 4B on tile[1] it works as expected. I don't understand this, as the HW schematic shows it connected to two ports - one on each tile.
-
- XCore Legend
- Posts: 1913
- Joined: Thu Jun 10, 2010 11:43 am
Change:
to
Also, prefix each call inside your par construct with:
and test again - first without the use of the I2C calls and then with the I2C calls. Please post your results.
Code: Select all
in port p_BT = on tile[0] : XS1_PORT_4D;
Code: Select all
on tile[0] : in port p_BT = XS1_PORT_4D;
Code: Select all
on tile[AUDIO_IO_TILE]: // assuming that AUDIO_IO_TILE is 0 (default)
par
{
on tile[0] :i2c_master_single_port(i2c, 2, p_i2c, 100, 0, 1, 0);
on tile[0] :input_gpio_with_events(i_buttons, 3, p_BT, null);
on tile[0] :usb_audio_io(i2c[0], c_mix_out, c_adc
#if defined(SPDIF_TX) && (SPDIF_TX_TILE != AUDIO_IO_TILE)
, c_spdif_tx
#endif
#ifdef MIXER
, c_mix_ctl
#endif
,c_aud_cfg, c_spdif_rx, c_adat_rx, c_clk_ctl, c_clk_int
#if XUD_TILE != 0
, dfuInterface
#endif
#if (NUM_PDM_MICS > 0)
, c_pdm_pcm
#endif
);
on tile[0] :GAIN_CNTRL(i2c[1], i_buttons[0], i_buttons[1], i_buttons[2]);
}
-
- XCore Addict
- Posts: 189
- Joined: Tue Jan 17, 2017 9:25 pm
Hi Mon, I finally had some time to test this. I get an "error: statement cannot be `on' a tile unless part of top-level par". I do understand what this means and will try to rearrange code to see if this fixes the problem as time allows.
I do have everything working with I2C by going back to using port 4B and setting up my par construct like this, so GPIO is on tile[1]:
I do have everything working with I2C by going back to using port 4B and setting up my par construct like this, so GPIO is on tile[1]:
Code: Select all
i2c_master_if i2c[2];
input_gpio_if i_buttons[3];
par
{
on tile[1]: input_gpio_with_events(i_buttons, 3, p_controls, null);
on tile[XUD_TILE]:
par
{
......
}
on tile[AUDIO_IO_TILE]:
par
{
i2c_master_single_port(i2c, 2, p_i2c, 100, 0, 1, 0);
usb_audio_io(i2c[0], c_mix_out, c_adc
#if defined(SPDIF_TX) && (SPDIF_TX_TILE != AUDIO_IO_TILE)
, c_spdif_tx
#endif
#ifdef MIXER
, c_mix_ctl
#endif
,c_aud_cfg, c_spdif_rx, c_adat_rx, c_clk_ctl, c_clk_int
#if XUD_TILE != 0
, dfuInterface
#endif
#if (NUM_PDM_MICS > 0)
, c_pdm_pcm
#endif
);
user_control(i2c[1], i_buttons[0], i_buttons[1], i_buttons[2]);
}
......