This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Can't read with cyg_io_read()


hi eCos fans,

I don't know if it is the apropriate way to ask such things, but I haven't found a board for ecos-developers, so I'll make it short:

I am testing the serial communication via eCos api. Writing is not the issue, there is a example, and it works.

But I can't read anything from serial device. I connected it to my PC where I am tryting to write (with keyboard) some characters via a terminal e.g. MS Hyperterminal. I also tried it by sending a "hello" via the Win32 Serial API. But my controller application waits forever. I am sure that I have sent the characters (as I used a serial port scanner).

My eCos example code would look like this:

static void simple_prog(CYG_ADDRESS data)
{
    cyg_io_handle_t handle;
    Cyg_ErrNo err;
    
	const char send_string[] = "Hallo";
	cyg_uint32 len = strlen(send_string)+1;
	
	char read_string[6];
	cyg_uint32 len2 = 6;

    
    	err = cyg_io_lookup( "/dev/haldiag", &handle );
	
    if (ENOERR == err) {
        	/*Now the test_string will be written using the serial API*/
        	err = cyg_io_write( handle, send_string, &len );
	}

	err = cyg_io_read( handle, read_string, &len2 );	

    if (ENOERR == err) {
		err = cyg_io_write( handle, read_string, &len2 );
	}

    /*printf("Serial example finished\n");*/
}

void cyg_user_start(void)
{
    cyg_thread_create(4, simple_prog, (cyg_addrword_t) 0, "serial",
                      (void *)stack[0], STACKSIZE, &thread[0], &thread_obj[0]);
    cyg_thread_resume(thread[0]);
}

But it wont get anything.

Do u know why?
-- 
Psst! Geheimtipp: Online Games kostenlos spielen bei den GMX Free Games! 
http://games.entertainment.web.de/de/entertainment/games/free

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]