I've added this code at teh beginning of the program to test if teh mutex is not NULL:
mutex = altera_avalon_mutex_open(MUTEX_NAME);
if (mutex == NULL) /* for testing only */
{
error_code = ERROR_OPENED_INVALID_MUTEX;
printf("error \n");
goto error;
}
The two cpu do not access to this if, this means that the mutex is not NULL,
I also added a printf inside the if of cpu1 after wrinting data, which displays hello in console and it's OK
However the data read by cpu2 is fault
How to be sure that the second CPU is reading the value after the first one set it?
Please help me