среда, 24 августа 2016 г., 14:45:54 UTC+4 пользователь Viktor Butckikh 
написал:
>
> Hello.
>
> I'm new comer  in PRU programming. I have built PRU example 
> PRU_RPMsg_Echo_Interrupt0 and loaded to Sitara PRU0. In general case this 
> sample work when I manually send following command "echo hello > 
> /dev/rpmsg_pru30" and "cat /dev/rpmsg_pru30". After that I decided to write 
> small test program which send data to PRU and reading back:
>
> #include <stdio.h>
> #include <stdlib.h>
> // Driver header file
> //#include "prussdrv.h"
> //#include "pruss_intc_mapping.h"
> #include <sys/stat.h>
> #include <fcntl.h>
> #include <stdint.h>
> #include <stdlib.h>
> #include <unistd.h>
> #include <signal.h>
> #define DEVICE_PATH "/dev/rpmsg_pru30"
> #define GET_MSG_ID  0x4745544D
> #define PRU_BUFF_SIZE 256
>
> int            sig_stop;            // сигнал завершения работы программы
> static void sign_term(int sig)
> {
>      switch(sig){
>         case SIGTERM:
>             sig_stop=1;
>         break;
>     }
> }
>
> int main(int argc, char **argv)
> {
>    int fd;
>    char data_buff[513];
>    uint32_t send_data=GET_MSG_ID;
>    fd=open(DEVICE_PATH,O_RDWR);
>    int ret;
>    FILE* data_file=fopen("balisa.bin","wb+");
>    int start_write;
>    start_write=0;
>    sig_stop=0;
>    int total_recv_bytes=0;
>    if(fd>0 && data_file!=0){
>        printf("Program started\n"); fflush(stdout);
>        while(sig_stop==0){
>             ret=write(fd,&send_data,4);
>             if(ret!=4){
>                 printf("Failed send data to PRU\n"); fflush(stdout);
>             }
>             ret=read(fd,data_buff,sizeof(data_buff));
>             if(ret<PRU_BUFF_SIZE && start_write==0){ start_write=1;}
>             if(ret==PRU_BUFF_SIZE && start_write==1){
>                 printf("RPMSG buffer overflow\n"); fflush(stdout);
>             }
>             if(start_write==1 && ret>0){
>                 total_recv_bytes+=ret;
>                 printf("Start writing %d. Total bytes 
> %d\n",ret,total_recv_bytes); fflush(stdout);
>                 fwrite(data_buff,1,ret,data_file);
>                 fflush(data_file);
>             }
>             
>        }
>
>
>    }
>    printf("Program finished\n"); fflush(stdout);
>    if(data_file!=0){fclose(data_file);}
>    if(fd>0){close(fd);}
>    return 0;
> }
>
> In first 15 seconds program is workin fine, but the system hang up.
>
> Could you help me in this issue?
>
> My board - beaglebone black.
>
> My Linux based on 4.4.16
>
> PRU compiller from CCS 6.1.3
>
>
> I've made small ivestigation (added usleep to my loop) and found 
> interesting thing - hang up happened when I send/recieve about 
> 262220..262600 bytes from PRU. Withot usleep it's happened earlier. 
>
> Thank you
>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/a211a007-6a7f-4243-a269-00a6277c5e82%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to