Hi i'm new to both CAN and eCos, i'm working on ubuntu. iam able to transmit date where i could see through PCAN connected to windows system. when i try to receive date send by windows system through PCAN iam unable to receive the date. can any one help me with this issue .....
only receiving program ... void can0_thread(cyg_addrword_t data) { cyg_io_handle_t hCAN0; cyg_uint8 i; cyg_uint32 len; cyg_can_buf_info_t rx_buf_info; cyg_can_event rx_event; cyg_can_msgbuf_cfg msgbox_cfg; if (ENOERR != cyg_io_lookup("/dev/can1", &hCAN0)) { CYG_TEST_FAIL_FINISH("Error opening /dev/can1"); } // // Enable reception of all available CAN messages // cyg_can_filter rx_filter; rx_filter.cfg_id = CYGNUM_CAN_MSGBUF_RX_FILTER_ALL; rx_filter.msg.ext = CYGNUM_CAN_ID_STD; len = sizeof(rx_filter); if (ENOERR != cyg_io_set_config(hCAN0, CYG_IO_SET_CONFIG_CAN_MSGBUF , &rx_filter, &len)) { CYG_TEST_FAIL_FINISH("Error writing config of /dev/can0"); } can_cfg.baud = CYGNUM_CAN_KBAUD_250; len = sizeof(can_cfg); if (ENOERR != cyg_io_set_config(hCAN0, CYG_IO_SET_CONFIG_CAN_INFO ,&can_cfg, &len)) { CYG_TEST_FAIL_FINISH("Error writing config of /dev/can0"); } len = sizeof(rx_buf_info); if (ENOERR != cyg_io_get_config(hCAN0, CYG_IO_GET_CONFIG_CAN_BUFFER_INFO ,&rx_buf_info, &len)) { CYG_TEST_FAIL_FINISH("Error reading config of /dev/can1"); } while (1) { len = sizeof(rx_event); if (ENOERR != cyg_io_read(hCAN0, &rx_event, &len)) { CYG_TEST_FAIL_FINISH("Error reading from /dev/can1"); } diag_printf("rx_event = %d\nCYGNUM_CAN_EVENT_RX = %d\n",rx_event.flags,CYGNUM_CAN_EVENT_RX); if (!(rx_event.flags & CYGNUM_CAN_EVENT_RX)) { CYG_TEST_FAIL_FINISH("Received wrong CAN event type"); } print_can_msg(&rx_event.msg, ""); printf("\n\n\n\n"); cyg_semaphore_timed_wait( &sem_wait, cyg_current_time( ) + 200 ); } // while (1) } void cyg_start(void) { cyg_io_handle_t hCAN0; cyg_uint32 len; cyg_can_info_t can_cfg; CYG_TEST_INIT(); // // create the threads that access the CAN device driver // cyg_thread_create(4, can0_thread, (cyg_addrword_t) 0, "can0_thread", (void *) can0_thread_data.stack, 1024 * sizeof(long), &can0_thread_data.hdl, &can0_thread_data.obj); // // setup CAN baudrate 250 KBaud // //can_cfg.baud = CYGNUM_CAN_KBAUD_100; //len = sizeof(can_cfg); //if (ENOERR != cyg_io_set_config(hCAN0, CYG_IO_SET_CONFIG_CAN_INFO ,&can_cfg, &len)) //{ //CYG_TEST_FAIL_FINISH("Error writing config of /dev/can0"); //} cyg_thread_resume(can0_thread_data.hdl); cyg_scheduler_start(); } #else // CYGFUN_KERNEL_API_C #define N_A_MSG "Needs kernel C API" #endif #else // CYGPKG_IO_CAN && CYGPKG_KERNEL #define N_A_MSG "Needs IO/CAN and Kernel" #endif #ifdef N_A_MSG void cyg_start( void ) { CYG_TEST_INIT(); CYG_TEST_NA( N_A_MSG); } #endif // N_A_MSG -- View this message in context: http://old.nabble.com/CAN-on-eCos-tp31867757p31867757.html Sent from the Sourceware - ecos-discuss mailing list archive at Nabble.com. -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss