Hello.
We are trying to read out the internal ADCs of the vybrid using linux.
We are using Yocto and Timesys BSP to build our custom Linux BSP. (Kernel 3.0.15)
Our board is based on the Vybrid VF65GS10.
Spesifically these: (from Vybrid ref. manual)
Dedicated PAD - ADC0SE8 External
Dedicated PAD - ADC1SE8 External
Dedicated PAD - ADC0SE9 External
Dedicated PAD - ADC1SE9 External
We have managed to read out the ADC0SE8, ADC0SE9 channels using the mvf-adc.0 device.
We have tried altering the BSP by adding mvd-adc.1, but this fails with the following code
mvf-adc mvf-adc.1074102272: failed to get adc irq
mvf-adc: probe of mvf-adc.1074102272 failed with error -22
Any tips on how to read the latter two?
Thanks for your time.
Reference to others who have accessed the ADC's
http://developer.toradex.com/knowledge-base/adc-%28linux%29
Userspace code snippet for accessing and reading from the mvf-adc.n
http://developer.toradex.com/files/toradex-dev/uploads/media/Colibri/Linux/Samples/adc-test.c
Solved! Go to Solution.
Hi Andreas,
Can you share your BSP modifications related to ADC 0 & 1, so we can review?
Thanks,
Timesys Support
From the manual, it states that the mentioned ADC's are dedicated pads, so we assume they don't conflict with other functionality (e.g. alternate functionality for pins).
We've tried adding a second adc in the mach-mvf/board-twr-vf700.c file:
static void __init mvf_init_adc(void)
{
mvf_add_adc(0);
+ mvf_add_adc(1);
}
Additions to the mach-mvf/clock.c file:
static struct clk_lookup lookups[] = {
_REGISTER_CLOCK(NULL, "mvf-uart.2", uart_clk[0]),
_REGISTER_CLOCK(NULL, "mvf-uart.3", uart_clk[0]),
_REGISTER_CLOCK("mvf-dspi.0", NULL, dspi_clk[0]),
_REGISTER_CLOCK("pit", NULL, pit_clk),
_REGISTER_CLOCK("fec.0", NULL, enet_clk[0]),
_REGISTER_CLOCK("fec.1", NULL, enet_clk[1]),
_REGISTER_CLOCK("mvf-adc.0", NULL, adc_clk[0]),
+ _REGISTER_CLOCK("mvf-adc.1", NULL, adc_clk[1]),
..
static struct clk adc_clk[] = {
{
__INIT_CLK_DEBUG(adc_clk)
.id = 0,
.parent = &ipg_clk,
.enable_reg = MXC_CCM_CCGR1,
.enable_shift = MXC_CCM_CCGRx_CG11_OFFSET,
.enable = _clk_enable,
.disable = _clk_disable,
},
+ {
+ __INIT_CLK_DEBUG(adc_clk)
+ .id = 1,
+ .parent = &ipg_clk,
+ .enable_reg = MXC_CCM_CCGR7,
+ .enable_shift = MXC_CCM_CCGRx_CG11_OFFSET,
+ .enable = _clk_enable,
+ .disable = _clk_disable,
+ },
};
Hi Andreas,
Thanks for sharing these changes. Based on these, you will also need to modify arch/arm/plat-mxc/devices/platform-mvf-adc.c to account for the addition of ADC1, by adding another value to the mvfa5_adc_data array. Please see arch/arm/mach-mvf/devices-mvf.h to see how your mvf_add_adc(1); call interacts with platform-mvf-adc.c.
Thanks,
Timesys Support
timesyssupport please continue with the follow up.
timesyssupport can you help to review this case?