Project

General

Profile

SPI interface for ADC5560 (MityDSP L138F)

Added by Vivek Ponnani about 3 years ago

Hi,

I have a custom board with
1) MityDspl-138F module (with FPGA)
2) No Ethernet port
3) UART,USB,SD CARD interface

I have built VM with MityDSP-L138_SDK_2012_06_13.ova file from critical link.

I am able to run Hello World Example on the customized board. (Schematics Attached)

We are trying to set up the environment for reading analog data with ADC5560. The hardware design is very much similar to the Analog Expansion Board. (Schematics Attached).

We downloaded the complete Analog Expansion Suite provided on the Critical link website. We are using the same software along with the MDK provided. We are using UPP interface for both analog data capture and DAC.

We are having problem to set up the ADC with SPI interface through ARM. The reference file we are using for ADC setup from ARM is arm_ADS5560.cpp. We are getting the following error message after we run the software on the customized board:

“can't set spi mode: Bad file descriptor
Aborted”

The debug file attached is debug_30june2017.txt.

Thanks in advance for support.


Replies (7)

RE: SPI interface for ADC5560 (MityDSP L138F) - Added by Vivek Ponnani about 3 years ago

Vivek Ponnani wrote:

Hi,

I have a custom board with
1) MityDspl-138F module (with FPGA)
2) No Ethernet port
3) UART,USB,SD CARD interface

I have built VM with MityDSP-L138_SDK_2012_06_13.ova file from critical link.

I am able to run Hello World Example on the customized board. (Schematics Attached)

We are trying to set up the environment for reading analog data with ADC5560. The hardware design is very much similar to the Analog Expansion Board. (Schematics Attached).

We downloaded the complete Analog Expansion Suite provided on the Critical link website. We are using the same software along with the MDK provided. We are using UPP interface for both analog data capture and DAC.

We are having problem to set up the ADC with SPI interface through ARM. The reference file we are using for ADC setup from ARM is arm_ADS5560.cpp. We are getting the following error message after we run the software on the customized board:

“can't set spi mode: Bad file descriptor
Aborted”

The debug file attached is debug_30june2017.txt.

Thanks in advance for support.

Hello,

As I have a problem to set up the ADC with SPI interface through ARM, I found that I have to recompile kernel to support analog expansion suite from the page

https://support.criticallink.com/redmine/projects/90-000173/wiki

I tried to run following command at mitydsp@vagrantup:~/projects/linux-davinci$

1)mitydsp@vagrantup:~/projects/linux-davinci$ make ARCH=arm CROSS_COMPILE=arm-angrstom-linux-gnueabi- industrialio_analogexp_defconfig
2)mitydsp@vagrantup:~/projects/linux-davinci$ . /usr/local/oecore-i686/environment-setup-armv5te-angstrom-linux-gnueabi
3)mitydsp@vagrantup:~/projects/linux-davinci$ make ARCH=arm CROSS_COMPILE=arm-angstrom-linux-gnueabi- uImage
This command generate uImage file in home/mitydsp/projects/linux-davinci/arc/arm/boot folder.
4)mitydsp@vagrantup:~/projects/linux-davinci$ make ARCH=arm CROSS_COMPILE=arm-angstrom-linux-gnueabi- modules
5)mitydsp@vagrantup:~/projects/linux-davinci$ make ARCH=arm CROSS_COMPILE=arm-angstrom-linux-gnueabi- modules_install INSTALL_MOD_PATH=$PWD/kernel_modules - this will generate Kernel_modules folder in home/mitydsp/projects/linux-davinci.

As per https://support.criticallink.com/redmine/projects/90-000173/wiki, Rebuild FPGA kerne modules.

So I followed https://support.criticallink.com/redmine/projects/arm9-platforms/wiki/FPGA_Core_Device_Drivers.

But when I give the command

1)mitydsp@vagrantup:~/projects/linux-davinci$ make C ../../MDK_2014-01-13/sw/ARM/linux/linux-davinci M=`pwd` ARCH=arm CROSS_COMPILE=arm-angstrom-linux-gnueabi modules

The response is as below.

make: Entering directory `/home/mitydsp/MDK_2014-01-13/sw/ARM/linux/linux-davinci'

ERROR: Kernel configuration is invalid.
include/generated/autoconf.h or include/config/auto.conf are missing.
Run 'make oldconfig && make prepare' on kernel src to fix it.
WARNING: Symbol version dump /home/mitydsp/MDK_2014-01-13/sw/ARM/linux/linux-davinci/Module.symvers
is missing; modules will have no dependencies and modversions.
CC      kernel/bounds.s
kernel/bounds.c:1:0: fatal error: can't open kernel/bounds.s for writing: Permission denied
compilation terminated.
make[1]: * [kernel/bounds.s] Error 1
make: *
[_module_/home/mitydsp/projects/linux-davinci] Error 2
make: Leaving directory `/home/mitydsp/MDK_2014-01-13/sw/ARM/linux/linux-davinci'

My queries are

1) The above error is because MDK_2014-01-13 is read only folder?
2) What I am doing is the correct way to support ADC 5560 with SPI interface? In baseboard-industrialio.c file ADC interface is included only if #ifdef CONFIG_INDIO_EXPANSION_ANALOGIO is there. I think if we rebuild kernel with above procedure it will define CONFIG_INDIO_EXPANSION_ANALOGIO to support analog expansion suite.
3) Is it necessary to rebuild FPGA Kernel modules for this? or only we can copy uImage to board and it will work.

Please guide.

Thanks.

RE: SPI interface for ADC5560 (MityDSP L138F) - Added by Jonathan Cormier about 3 years ago

Vivek Ponnani wrote:

Hello,

As I have a problem to set up the ADC with SPI interface through ARM, I found that I have to recompile kernel to support analog expansion suite from the page

https://support.criticallink.com/redmine/projects/90-000173/wiki

I tried to run following command at mitydsp@vagrantup:~/projects/linux-davinci$

1)mitydsp@vagrantup:~/projects/linux-davinci$ make ARCH=arm CROSS_COMPILE=arm-angrstom-linux-gnueabi- industrialio_analogexp_defconfig
2)mitydsp@vagrantup:~/projects/linux-davinci$ . /usr/local/oecore-i686/environment-setup-armv5te-angstrom-linux-gnueabi
3)mitydsp@vagrantup:~/projects/linux-davinci$ make ARCH=arm CROSS_COMPILE=arm-angstrom-linux-gnueabi- uImage
This command generate uImage file in home/mitydsp/projects/linux-davinci/arc/arm/boot folder.
4)mitydsp@vagrantup:~/projects/linux-davinci$ make ARCH=arm CROSS_COMPILE=arm-angstrom-linux-gnueabi- modules
5)mitydsp@vagrantup:~/projects/linux-davinci$ make ARCH=arm CROSS_COMPILE=arm-angstrom-linux-gnueabi- modules_install INSTALL_MOD_PATH=$PWD/kernel_modules - this will generate Kernel_modules folder in home/mitydsp/projects/linux-davinci.

Here we see the kernel you are building is located at ~/projects/linux-davinci.

As per https://support.criticallink.com/redmine/projects/90-000173/wiki, Rebuild FPGA kerne modules.

So I followed https://support.criticallink.com/redmine/projects/arm9-platforms/wiki/FPGA_Core_Device_Drivers.

But when I give the command

1)mitydsp@vagrantup:~/projects/linux-davinci$ make C ../../MDK_2014-01-13/sw/ARM/linux/linux-davinci M=`pwd` ARCH=arm CROSS_COMPILE=arm-angstrom-linux-gnueabi modules

But here you are referencing a different kernel. You need to use the same kernel as above.
make C ~/projects/linux-davinci M=`pwd` ARCH=arm CROSS_COMPILE=arm-angstrom-linux-gnueabi modules

My queries are

1) The above error is because MDK_2014-01-13 is read only folder?

From the logs you posted, the reason its complaining is because you never built the kernel located in the MDK. I'd recommend sticking with the kernel located at ~/projects/linux-davinci

2) What I am doing is the correct way to support ADC 5560 with SPI interface? In baseboard-industrialio.c file ADC interface is included only if #ifdef CONFIG_INDIO_EXPANSION_ANALOGIO is there. I think if we rebuild kernel with above procedure it will define CONFIG_INDIO_EXPANSION_ANALOGIO to support analog expansion suite.

By enabling CONFIG_INDIO_EXPANSION_ANALOGIO, it should create the /dev/spidev1.4 when you boot the kernel. Your original error seems to indicate that this device node may not have existed. “can't set spi mode: Bad file descriptor". You'd want to check to see if /dev/spidev1.4 was there.

If you don't have a /dev/spidev1.4 device then post your full bootlog and your .config file.

3) Is it necessary to rebuild FPGA Kernel modules for this? or only we can copy uImage to board and it will work.

Since you've connected the ADC5560 to the spi1 bus, you don't need the fpga_spi module to get the ADC working.

For the analog io board, the ADS1158 ADC was connected to an fpga spi bus which was why it required the fpga_spi module.

RE: SPI interface for ADC5560 (MityDSP L138F) - Added by Vivek Ponnani about 3 years ago

Thanks for your explanation Jonathan.

Please guide for below queries.

1) As we are preparing SD card for Linux kernel and its file system from the \MDK_2014-01-13\fs\mityomap-full. As per my understanding I have to overwrite generated new uImage
in \MDK_2014-01-13\fs\mityomap-full\boot folder, is that correct? No need to change anything else?

2) As I followed https://support.criticallink.com/redmine/projects/90-000173/wiki,
The folder Kernel_modules is generated under mitydsp@vagrantup:~/projects/linux-davinci/kernel. And as per wiki guide
"Transfer the new kernel image and modules to the devkit according to where the filesystem is currently installed to (NAND, MMC, NFS...)."
But I don't understand which modules should be transferred? There are 42 *.ko files generated in kernel_modules folder. Should I check manually each *.ko file in the
kernel_modules and copy it to the respective folder of \MDK_2014-01-13\fs\mityomap-full?

3) Anything else I need to do to get new Linux kernel and its filesystem?

Thanks

RE: SPI interface for ADC5560 (MityDSP L138F) - Added by Jonathan Cormier about 3 years ago

Thanks for your explanation Jonathan.

Please guide for below queries.

1) As we are preparing SD card for Linux kernel and its file system from
the \MDK_2014-01-13\fs\mityomap-full. As per my understanding I have to
overwrite generated new uImage
in \MDK_2014-01-13\fs\mityomap-full\boot folder, is that correct? No need
to change anything else?

I would create the SD card first. Then update the uImage in the boot folder.

2) As I followed
https://support.criticallink.com/redmine/projects/90-000173/wiki,
The folder Kernel_modules is generated under mitydsp@vagrantup:~/projects/linux-davinci/kernel.
And as per wiki guide
"Transfer the new kernel image and modules to the devkit according to
where the filesystem is currently installed to (NAND, MMC, NFS...)."
But I don't understand which modules should be transferred? There are 42
.ko files generated in kernel_modules folder. Should I check manually each
.ko file in the
kernel_modules and copy it to the respective folder of
\MDK_2014-01-13\fs\mityomap-full?

The kernel_modules directory should have the full path for the modules. So
you can copy the whole directory.

cp -vr kernel_modules/* /sdcard-location/

3) Anything else I need to do to get new Linux kernel and its filesystem?

This should be all.

RE: SPI interface for ADC5560 (MityDSP L138F) - Added by Vivek Ponnani about 3 years ago

Thanks for your guidance. I am able to run analog expansion suite examples for ADS 5560 and DAC 5672 individually. Now I am trying to give analog input to ADS 5560 and want to generate the same analog output using DAC 5672. For that I pass the same values (received in uPP buffer from ADC) to the DAC (transmit in uPP buffer), but I am not able to generate the analog signal. I am using the reference files in analog expansion suite (ADS5560.cpp and DAC5672.CPP). I have not used the logic used to generate data in DAC 5672. Is there any specific purpose to generate data with this logic. I am not able to understand the logic (below for loop)for generating sample data and the comment for n issue with timing with the fpga. Could you please explain the logic behind that? Is it required to do some process on data from ADC to reproduce the same analog output from DAC?

*if(!filled) {
const double PI = 4.0*atan(1.0);
for( int i = 0; i < SAMPLE_SIZE; i++){
temp = amplitude;
temp *= (1<<13-1);
//the 40 MHz used to be uppClock. There is a n issue with timing with the fpga,
//which requires the generation of the wave to be based on the fpga's sampling frequency.
temp *= 1.0+sin(2.0f * PI * ( ( float ) 500000 / 40000000 ) * i);
//remember min and max values
if (temp > maxSign) {
maxSign = temp;
}
if (temp < minSign) {
minSign = temp;
}
data[i] = temp;
}
}*

Thanks.

ADS5560.h View (1.6 KB)

ADS5560.cpp View (8.7 KB)

DAC5672.cpp View (11.3 KB)

DAC5672.h View (2.35 KB)

RE: SPI interface for ADC5560 (MityDSP L138F) - Added by Jonathan Cormier about 3 years ago

Vivek Ponnani wrote:

Thanks for your guidance. I am able to run analog expansion suite examples for ADS 5560 and DAC 5672 individually. Now I am trying to give analog input to ADS 5560 and want to generate the same analog output using DAC 5672. For that I pass the same values (received in uPP buffer from ADC) to the DAC (transmit in uPP buffer), but I am not able to generate the analog signal. I am using the reference files in analog expansion suite (ADS5560.cpp and DAC5672.CPP). I have not used the logic used to generate data in DAC 5672. Is there any specific purpose to generate data with this logic. I am not able to understand the logic (below for loop)for generating sample data and the comment for n issue with timing with the fpga. Could you please explain the logic behind that? Is it required to do some process on data from ADC to reproduce the same analog output from DAC?

*if(!filled) {
const double PI = 4.0*atan(1.0);
for( int i = 0; i < SAMPLE_SIZE; i++){
temp = amplitude;
temp *= (1<<13-1);
//the 40 MHz used to be uppClock. There is a n issue with timing with the fpga,
//which requires the generation of the wave to be based on the fpga's sampling frequency.
temp *= 1.0+sin(2.0f * PI * ( ( float ) 500000 / 40000000 ) * i);
//remember min and max values
if (temp > maxSign) {
maxSign = temp;
}
if (temp < minSign) {
minSign = temp;
}
data[i] = temp;
}
}*

Thanks.

I'm not that familiar with the DAC but none of the posted code above appears to be doing anything with the hardware. Its just generating sinewave data.

RE: SPI interface for ADC5560 (MityDSP L138F) - Added by Vivek Ponnani about 3 years ago

Thanks for your response. As mentioned before I am trying to get data on DAC output same as ADC input. But I am not getting proper output signal as Input. From the code I can see uPP is using 75MHz for clock and in FPGA code it seems it uses 40MHz. Is that correct? Is it possible that because of different clock, uPP interface with FPGA doesn't work properly? Currently I am passing the input data from uPP channel B( receive channel) to uPP channel A (transmit channel) without doing any processing on data. And that data will be passed to FPGA and then DAC through interface.

Thanks.

    (1-7/7)
    Add picture from clipboard (Maximum size: 500 MB)