2010-06-18 08:21:38     Error opening dev/ppi -1

Document created by Aaronwu Employee on Aug 22, 2013
Version 1Show Document
  • View in full screen mode

2010-06-18 08:21:38     Error opening dev/ppi -1

Jithender Golamari (IRELAND)

Message: 90415   

 

Hi There, I am using the following code to enable PPI on BF537.

 

#include <stdio.h>

#include <fcntl.h>

#include <sys/ioctl.h>

#include <unistd.h>

#include <errno.h>

#include <string.h>

#include <stdlib.h>

#include <sys/time.h>

#include "ppi.h"

#define CMD_PPI_PORT_ENABLE    1

#define CMD_PPI_PORT_DIRECTION 2

#define CFG_PPI_PORT_DIR_TX 1

#define CFG_PPI_PORT_ENABLE 1

 

#define SAMPLES 10

#define TEST

 

int main( )

{

    int fd, n;

    unsigned char data_write[SAMPLES]={1,2,3,4,5,6,7,8,9,10};

    unsigned char data_read[SAMPLES];

    fd = open("/dev/ppi0", O_RDWR);

 

    if(fd < 0)

    {

        printf( "Error opening dev/ppi %d\n", fd );

    }

 

    printf("Starting ioctl configuration \n");

    ioctl(fd, CMD_PPI_PORT_DIRECTION, CFG_PPI_PORT_DIR_TX);

    ioctl(fd, CMD_PPI_PACKING, CFG_PPI_PACK_DISABLE);

    ioctl(fd, CMD_PPI_SKIPPING, CFG_PPI_SKIP_DISABLE);

    ioctl(fd, CMD_PPI_SKIP_ODDEVEN, CFG_PPI_SKIP_ODD);

    ioctl(fd, CMD_PPI_DATALEN, CFG_PPI_DATALEN_8);

    ioctl(fd, CMD_PPI_CLK_EDGE, CFG_PPI_CLK_EDGE_RISE);

    ioctl(fd, CMD_PPI_TRIG_EDGE, CFG_PPI_TRIG_EDGE_RISE);

    ioctl(fd, CMD_PPI_XFR_TYPE, CFG_PPI_XFR_TYPE_NO_SYNC);

    ioctl(fd, CMD_PPI_PORT_CFG, CFG_PPI_PORT_CFG_SYNC1);

    ioctl(fd, CMD_PPI_SET_DIMS, CFG_PPI_DIMS_1D);

    ioctl(fd, CMD_PPI_DELAY, 0);

    ioctl(fd, CMD_PPI_FIELD_SELECT, CFG_PPI_FIELD_SELECT_1);

    ioctl(fd, CMD_PPI_SETGPIO);

    ioctl(fd, CMD_PPI_PORT_ENABLE, CFG_PPI_PORT_ENABLE);

    ioctl (fd, CMD_PPI_GET_ALLCONFIG);

    printf("End ioctl configuration \n");

 

 

    printf("Start data writing \n");

    write(fd, data_write, SAMPLES);

    printf("End data writing \n");

 

    //read(fd, data_read, SAMPLES);

 

    close(fd);

 

    return 0;

}

 

 

 

however I have the output as

 

Error opening dev/ppi -1                                                       

Starting ioctl configuration                                                   

End ioctl configuration                                                        

Start data writing                                                             

End data writing 

 

Not sure what I am doing wrong, can any1 help plz, thank you

QuoteReplyEditDelete

 

 

2010-06-18 09:23:59     Re: Error opening dev/ppi -1

Robin Getz (UNITED STATES)

Message: 90419   

 

Jithender:

 

Does /dev/ppi exist?

QuoteReplyEditDelete

 

 

2010-06-18 16:14:50     Re: Error opening dev/ppi -1

Jithender Golamari (IRELAND)

Message: 90431   

 

Robin,

 

Yeah it does, check on the stamp

 

-Jithender

QuoteReplyEditDelete

 

 

2010-06-18 16:15:45     Re: Error opening dev/ppi -1

Jithender Golamari (IRELAND)

Message: 90432   

 

Robin,

 

Yeah it does, checked on the stamp board

 

Thank you

 

-Jithender

 

---

QuoteReplyEditDelete

 

 

2010-06-19 13:05:42     Re: Error opening dev/ppi -1

Mike Frysinger (UNITED STATES)

Message: 90461   

 

so run it through `strace` to see the real error via errno

 

you havent said what version of software exactly you're using

QuoteReplyEditDelete

 

 

2010-06-19 21:08:21     Re: Error opening dev/ppi -1

Robin Getz (UNITED STATES)

Message: 90474   

 

Jithender:

 

That is why I asked - it shouldn't be there.

 

root:/> version

kernel:    Linux release 2.6.33.1-ADI-2010R1-pre-svn8588, build #633 Mon Apr 5 14:10:15 EDT 2010

toolchain: bfin-linux-uclibc-gcc release gcc version 4.3.4 (ADI-trunk/svn-3951)

user-dist: release svn-9497, build #307 Mon Mar 29 11:54:47 EDT 2010

root:/> ls /dev/ppi*

ls: /dev/ppi*: No such file or directory

 

 

You are using something that might be old, and obsolete.

 

-Robin

QuoteReplyEditDelete

 

 

2010-06-21 05:04:02     Re: Error opening dev/ppi -1

Jithender Golamari (IRELAND)

Message: 90498   

 

Sorry about that Version I am Using is:

 

root:~> version                                                               

Linux release 2.6.19.3-ADI-2007R1.1-svn, build #1 Mon Aug 20 16:34:38 CST 2007

release 2007R1, build #1 Mon Aug 20 16:45:54 CST 2007

QuoteReplyEditDelete

 

 

2010-06-21 05:05:16     Re: Error opening dev/ppi -1

Jithender Golamari (IRELAND)

Message: 90499   

 

root:~> version                                                               

Linux release 2.6.19.3-ADI-2007R1.1-svn, build #1 Mon Aug 20 16:34:38 CST 2007

release 2007R1, build #1 Mon Aug 20 16:45:54 CST 2007                        

root:~> ls /dev/ppi*                                                          

/dev/ppi0 

 

Thank you

 

-Jithender

QuoteReplyEditDelete

 

 

2010-06-21 08:18:56     Re: Error opening dev/ppi -1

Jithender Golamari (IRELAND)

Message: 90500   

 

MIke, Following is the output when I ran strace:

 

 

 

root:~> strace /ppitest1                                                      

ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B57600 opost isig icanon echo ...}) = 0

ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, {B57600 opost isig icanon echo ...}) = 0

open("/dev/ppi0", O_RDWR)               = -1 ENXIO (No such device or address)

write(1, "Error opening dev/ppi -1\n", 25Error opening dev/ppi -1             

) = 25                                                                        

write(1, "Starting ioctl configuration \n", 30Starting ioctl configuration    

) = 30                                                                        

ioctl(-1, FIGETBSZ, 0x1)                = -1 EBADF (Bad file descriptor)      

ioctl(-1, 0x6, 0)                       = -1 EBADF (Bad file descriptor)      

root:~> strace /ppitest1

ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B57600 opost isig icanon echo ...}) = 0

ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, {B57600 opost isig icanon echo ...}) = 0

open("/dev/ppi0", O_RDWR)               = -1 ENXIO (No such device or address)

write(1, "Error opening dev/ppi -1\n", 25Error opening dev/ppi -1

) = 25

write(1, "Starting ioctl configuration \n", 30Starting ioctl configuration

) = 30

ioctl(-1, FIGETBSZ, 0x1)                = -1 EBADF (Bad file descriptor)

ioctl(-1, 0x6, 0)                       = -1 EBADF (Bad file descriptor)

ioctl(-1, 0x7, 0)                       = -1 EBADF (Bad file descriptor)

ioctl(-1, 0x8, 0)                       = -1 EBADF (Bad file descriptor)

ioctl(-1, 0x9, 0)                       = -1 EBADF (Bad file descriptor)

ioctl(-1, 0xa, 0)                       = -1 EBADF (Bad file descriptor)

ioctl(-1, 0xb, 0)                       = -1 EBADF (Bad file descriptor)

ioctl(-1, 0x3, 0)                       = -1 EBADF (Bad file descriptor)

ioctl(-1, 0x4, 0)                       = -1 EBADF (Bad file descriptor)

ioctl(-1, 0xf, 0x1)                     = -1 EBADF (Bad file descriptor)

ioctl(-1, 0x10, 0)                      = -1 EBADF (Bad file descriptor)

ioctl(-1, 0x5, 0)                       = -1 EBADF (Bad file descriptor)

ioctl(-1, 0x11, 0)                      = -1 EBADF (Bad file descriptor)

ioctl(-1, FIBMAP, 0x1)                  = -1 EBADF (Bad file descriptor)

ioctl(-1, 0x28, 0x1)                    = -1 EBADF (Bad file descriptor)

write(1, "End ioctl configuration \n", 25End ioctl configuration              

) = 25                                                                        

write(1, "Start data writing \n", 20Start data writing                        

)   = 20                                                                      

write(-1, "\1\2\3\4\5\6\7\10\t\n", 10)  = -1 EBADF (Bad file descriptor)      

write(1, "End data writing \n", 18End data writing                            

)     = 18                                                                    

close(-1)                               = -1 EBADF (Bad file descriptor)      

exit(0)                                 = ?      

 

can u plz advise?? Thank u

 

 

 

- Jithender

QuoteReplyEditDelete

 

 

2010-06-21 08:39:15     Re: Error opening dev/ppi -1

Robin Getz (UNITED STATES)

Message: 90501   

 

Jithender:

 

Look at the open (...) function - it means /dev/ppi0 doesn't exist.

QuoteReplyEditDelete

 

 

2010-06-21 08:42:59     Re: Error opening dev/ppi -1

Robin Getz (UNITED STATES)

Message: 90502   

 

Jithender:

 

We do not support distributions that are 3 years old. Upgrade to the most recent release.

 

-Robin

QuoteReplyEditDelete

 

 

2010-06-21 09:13:35     Re: Error opening dev/ppi -1

Jithender Golamari (IRELAND)

Message: 90504   

 

Robin,

 

Can you please confirm if  I have to follow below documentation for upgrading.

 

 

 

https://docs.blackfin.uclinux.org/doku.php?id=bootloaders:u-boot:upgrading

 

https://docs.blackfin.uclinux.org/doku.php?id=bootloaders:u-boot:parallel-flash

 

https://docs.blackfin.uclinux.org/doku.php?id=bootloaders:u-boot:tftp_loading_files

 

 

 

Thank you

 

-Jithender

QuoteReplyEditDelete

 

 

2010-06-21 13:29:26     Re: Error opening dev/ppi -1

Robin Getz (UNITED STATES)

Message: 90515   

 

Jithender:

 

Yes - you need to upgrade U-Boot, the kernel and dist, and the toolchain.

 

See the faq.

 

-Robin

QuoteReplyEditDelete

 

 

2010-06-21 16:56:31     Re: Error opening dev/ppi -1

Jithender Golamari (IRELAND)

Message: 90518   

 

Cool, Thank you.

 

 

 

-Jithender

QuoteReplyEditDelete

 

 

2010-06-28 11:22:24     Re: Error opening dev/ppi -1

Jithender Golamari (IRELAND)

Message: 90690   

 

Hi Again,

 

I tried to upgrading the kernel on BF537, however I dont have any luck.

 

I downloaded the u-boot.bin file from "  blackfin.uclinux.org/gf/project/bluetechnix/frs/"

 

and tried tftp which was sucessesfull, however when I type go 0x1000000, it doesnt do anything.

 

 

 

bf537> tftp 0x1000000 u-boot.bin                                              

Using BF537 ETHERNET device                                                   

TFTP from server 10.241.16.72; our IP address is 10.241.16.75                 

Filename 'u-boot.bin'.                                                        

Load address: 0x1000000                                                       

Loading: ################################                                     

done                                                                          

Bytes transferred = 159324 (26e5c hex)                                        

bf537> go 0x1000000                                                           

## Starting application at 0x01000000 ...

 

I also tried to boot with u-boot.ldr from the host but I got the following error message

 

 

 

bfin-uclinux-ldr -l u-boot.ldr /dev/ttyS0 -p

Loading LDR u-boot.ldr ... OK!

Opening /dev/ttyS0 ... OK!

Configuring terminal I/O ... OK!

 

Press any key to send autobaud: Trying to send autobaud ... OK!

 

Press any key to read autobaud: Trying to read autobaud ... bfin-uclinux-ldr: received signal 14: timeout while sending; aborting.

 

 

 

Can any1 please help.

 

 

 

Thank you

QuoteReplyEditDelete

 

 

2010-06-28 12:54:36     Re: Error opening dev/ppi -1

Mike Frysinger (UNITED STATES)

Message: 90699   

 

we dont support anything from that project.  if you want to use those files, you have to ask bluetechnix for support.  we only support files from the u-boot project.

 

as for the loading issue, you probably didnt setup the hardware correctly.  please read the documentation:

https://docs.blackfin.uclinux.org/doku.php?id=bootloaders:u-boot:loading#boot_via_the_uart

QuoteReplyEditDelete

 

 

2010-06-29 05:20:38     Re: Error opening dev/ppi -1

Jithender Golamari (IRELAND)

Message: 90727   

 

Mike,

 

 

 

Thanks for the reply. I am in the process of upgrading uboot kernel on BF537 to a newer version, I used the U-boot files from   blackfin.uclinux.org/gf/project/u-boot/frs and downloaded the file u-boot-bf537-stamp-2009R1.1-rc1.tar.bz2 as am Using BF537 Stamp.

 

Next, I extracted the folder into a folder named 'tftpboot' as advised in the documentation

 

"https://docs.blackfin.uclinux.org/doku.php?id=setting_up_a_tftp_server"

 

and tried to upgrade via Ethernet as advised in the doc https://docs.blackfin.uclinux.org/doku.php?id=bootloaders:u-boot:upgrading

 

but with no luck. As I said in my earlier post the .bin file is transferred via ethernet using tftp command to the load address 0x1000000. but when I try "go ox1000000" it doesnt do anything.

 

 

 

Not sure of whats hapening, can you please advise.

 

Thank you.

 

-Jithender

QuoteReplyEditDelete

 

 

2010-06-29 08:10:54     Re: Error opening dev/ppi -1

Robin Getz (UNITED STATES)

Message: 90729   

 

Jithender:

 

If you are using "go" on a old version of U-Boot, you may need to turn the caches off manually before the "go" command.

 

-Robin

QuoteReplyEditDelete

 

 

2010-06-29 08:59:44     Re: Error opening dev/ppi -1

Jithender Golamari (IRELAND)

Message: 90730   

 

Robin,

 

 

 

root:/> version                                                                

kernel:    Linux release 2.6.28.10-ADI-2009R1-svn7272, build #6 Tue Sep 8 11:459

toolchain: bfin-linux-uclibc-gcc release gcc version 4.1.2 (ADI svn)           

user-dist: release svn-8830, build #18 Tue Sep 8 11:45:10 CEST 2009

 

 

 

This is the version I got after truning off the caches and ran the go command.

 

can you please confirm if this is the latest version.

 

Thank you.

 

-Jithender

QuoteReplyEditDelete

 

 

2010-06-29 09:10:55     Re: Error opening dev/ppi -1

Robin Getz (UNITED STATES)

Message: 90731   

 

Jithender:

 

uClinux-dist shouldbe at 9613; kernel should be at 8921

 

-Robin

QuoteReplyEditDelete

 

 

2010-06-29 09:35:36     Re: Error opening dev/ppi -1

Jithender Golamari (IRELAND)

Message: 90732   

 

can you please advise how can I change that?

 

Thank you.

 

-Jithender

QuoteReplyEditDelete

 

 

2010-06-29 09:50:21     Re: Error opening dev/ppi -1

Robin Getz (UNITED STATES)

Message: 90733   

 

Jithender:

 

Update to svn branch.

 

-Robin

QuoteReplyEditDelete

 

 

2010-07-02 05:17:33     Re: Error opening dev/ppi -1

Jithender Golamari (IRELAND)

Message: 90829   

 

Robin,

 

 

 

Thanks for the info, I just wan to make sure if I am following the right docs:

 

 

 

when you say "update to svn branch" do u recommend to follow this documentation "  docs.blackfin.uclinux.org/doku.php?id=developing_with_blackfin_live_sources"

 

 

 

and use branch instead of trunk. can you please confirm.

 

 

 

Thank you

 

 

 

-Jithender

QuoteReplyEditDelete

 

 

2010-07-02 13:00:05     Re: Error opening dev/ppi -1

Robin Getz (UNITED STATES)

Message: 90842   

 

Jithender:

 

Yes - that is what I mean.

 

-Robin

QuoteReplyEditDelete

 

 

2010-07-02 13:19:37     Re: Error opening dev/ppi -1

Jithender Golamari (IRELAND)

Message: 90843   

 

Excellent thank you, greatly appreciate all your help.

 

 

 

-Jithender

QuoteReplyEditDelete

 

 

2010-07-06 10:51:44     Re: Error opening dev/ppi -1

Jithender Golamari (IRELAND)

Message: 90965   

 

-Robin.

 

 

 

As this was the first time I installed SVN on my PC, it took some time but finally I was able to complete all the following commands:

 

now I have linux-kernel, toolchain, u-boot, uclinux-dist folders in my blackfin-sources.

 

However I have a small problem, wen I tried to run the command :

 

 

 

/blackfin-sources/toolchain/buildscript/BuildToolChain \

     -b ~/blackfin-sources/build \

     -k ~/blackfin-sources/uclinux-dist/linux-2.6.x \

     -s ~/blackfin-sources/toolchain \

     -u ~/blackfin-sources/u-boot

 

 

 

it gave me an error message saying "Invalid U-Boot Path"

 

In my u-boot folder I have

 

u-boot-2010.03,

 

u-boot-2010.06,

 

u-boot_test_script,

BUILD-RELEASE & init.S

 

I tried re-directing the path to u-boot-2010.03 and u-boot-2010.06 but it still the same message, can you help me plz.

 

Thank you

 

 

 

-Jithender

QuoteReplyEditDelete

 

 

2010-07-06 14:05:23     Re: Error opening dev/ppi -1

Robin Getz (UNITED STATES)

Message: 90973   

 

Jithender:

 

You need to point it to the proper subdirectory in the u-boot checkout.

 

-Robin

QuoteReplyEditDelete

 

 

2010-07-08 05:31:19     Re: Error opening dev/ppi -1

Jithender Golamari (IRELAND)

Message: 91035   

 

cool, thnx Robin, dat worked. basically I was giving wrong destination folder, my bad

 

 

 

-Jithender

Attachments

    Outcomes