2008-06-17 09:50:12 problems with ppi
tom R (FRANCE)
Message: 57409
Hello!
I am testing a small program to test the ppi, but I can't visualize anything on PPI's pins with a probe. The kernel configuration seems to be good. I can only see a signal on port Tx. I have read a lot of docs. (ppi, timers) but I think I need someone gives me a hand. Here is my code:
#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 Taille 8
// static ssize_t ppi_write(struct file *filp, const char *buf, size_t count, loff_t *f_pos)
int main () {
int fd, retval;
unsigned char data_write[Taille]={1,2,3,4,5,6,7,8};
//unsigned char data_write[Taille]={0,0,0,0,0,0,0,0};
// unsigned char data_read[Taille];
close("/dev/ppi0");
//fd = release("/dev/ppi0", O_RDWR);
fd = open ("/dev/ppi0", O_RDWR);
if (fd < 0) {
printf("Error opening dev/ppi \n");
}
printf("Début de la configuration ioctl \n");
ioctl(fd, CMD_PPI_PORT_ENABLE,CFG_PPI_PORT_ENABLE);
ioctl(fd, CMD_PPI_XFR_TYPE, CFG_PPI_XFR_TYPE_NO_SYNC);
ioctl(fd, CMD_PPI_PORT_CFG, CFG_PPI_PORT_CFG_NA);
ioctl(fd, CMD_PPI_FIELD_SELECT, CFG_PPI_FIELD_SELECT_1);
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_LINELEN, CFG_PPI_DATALEN_8);
ioctl(fd, CMD_PPI_SET_DIMS, CFG_PPI_DIMS_1D);
ioctl(fd, CMD_PPI_DELAY, PPI_READ_NODELAY);
ioctl(fd, CMD_PPI_PORT_DIRECTION, CFG_PPI_PORT_DIR_TX);
ioctl(fd, CMD_PPI_SETGPIO);
ioctl (fd, CMD_PPI_GET_ALLCONFIG);
printf("\n Fin de la configuration ioctl \n");
int compteur=0;
printf("\n Ecriture des données \n");
do {
retval=write(fd, data_write, Taille);
if ( retval != Taille ) {
perror("ppi write error\n");
return 0;
}
printf("OK \n");
compteur++;
sleep (1);
} while (compteur<500);
printf("\n fin de l'écriture \n");
//read(fd, data_read, Taille);
close(fd);
return 0;
}
Are the lines as ioctl(fd, CMD_PPI_LINELEN, CFG_PPI_DATALEN_8); usefull when we want to send datas?
Did I forget something ?
Moreover, when I execute a second time the program, I can see:kernel panic: Unable to attach Blackfin Error Interrupt. I found that my program stopped in the fonction "wait_event_interruptible" of the ppidriver.
TranslateQuoteReplyEditDelete
2008-06-17 19:21:34 Re: problems with ppi
Mike Frysinger (UNITED STATES)
Message: 57434
what do you mean "can't visualize anything on PPI's pins with a probe" ? you said you're seeing the Tx pin wiggle ...
what toolchain/kernel version are you using ?
QuoteReplyEditDelete
2008-06-18 04:48:55 Re: problems with ppi
tom R (FRANCE)
Message: 57500
Hi! Thank you for having answered me!
I just want to see each PPI(0-15) signal with an oscilloscope. There is nothing connected to my board.
When the program begin, I can't see any information on signals PPI100-PPI15. All I have is a signal visible
on port Tx0 which is corresponding to nothing.
I am working on the uClinux-dist-2008R1-RC8 and the toolchain version esvn 0.6.12. I would know before if the
IOCTLs configuration are good, and why there is a Kernel panic error when I execute the program a second time.
(not syncing:Unable to attach Blackfin Error Interrupt)