Tool/software: TI-RTOS
I am running upp_bios_drv_v10's loopback test on my board. the test works fine. But when i tried to test it in a loop, the second time occur buf mismatch.
Then i rerun the application many times. The first time test is always ok. The second time, some buf is filled by 0. And the third time, all buf is filled by 0
I cannot figure out why. Can someone help me? Thank u in advance!
here is my demo code:
static void LOCAL_upp_demo(UArg a0, UArg a1) { int j = 0; for (;j < 3; j++) { upp_UserParams upp_setup; upp_Transfer upp_xfer_a, upp_xfer_b; GIO_Handle upph; int i, status, target_int_count; // initialize uPP buffers for (i = 0; i < sizeof(upp_buffer_a) / 4; i++) { // put data in transmit buffer and clear receive buffer if (upp_mode == LOCAL_mode_BA_dlb) { ((Uint32 *)upp_buffer_b)[i] = 0xAAAA5555; ((Uint32 *)upp_buffer_a)[i] = 0x00000000; } else { ((Uint32 *)upp_buffer_a)[i] = 0xAAAA5555; ((Uint32 *)upp_buffer_b)[i] = 0x00000000; } } // specify driver parameters LOCAL_upp_config(&upp_setup); // create driver handle //upph = GIO_create("/UPP", IOM_INOUT, &status, &upp_setup, NULL); GIO_Params gioParams; /* Create input GIO instance */ GIO_Params_init(&gioParams); gioParams.chanParams = &upp_setup; gioParams.model = ti_sysbios_io_GIO_Model_STANDARD; upph = GIO_create("/UPP", GIO_INOUT, &gioParams, NULL); if (upph == NULL) { System_printf("GIO_create failed"); return; } // program transfer(s) LOCAL_upp_config_xfers(&upp_xfer_a, &upp_xfer_b); System_printf("Programming uPP transfers..."); // note: begin read first if in DLB mode switch (upp_mode) { case LOCAL_mode_AB_dlb: status = GIO_read(upph, &upp_xfer_b, NULL); status |= GIO_write(upph, &upp_xfer_a, NULL); break; case LOCAL_mode_BA_dlb: status = GIO_read(upph, &upp_xfer_a, NULL); status |= GIO_write(upph, &upp_xfer_b, NULL); break; case LOCAL_mode_A_transmit: status = GIO_write(upph, &upp_xfer_a, NULL); break; case LOCAL_mode_A_receive: status = GIO_read(upph, &upp_xfer_a, NULL); break; default: // unrecognized mode (shouldn't happen) status = -1; break; } // catch GIO_submit errors) if (status < 0) { System_printf("Error programming uPP transfers.\n"); upp_error_count++; } // wait until transfer(s) complete target_int_count = (upp_mode == LOCAL_mode_AB_dlb || upp_mode == LOCAL_mode_BA_dlb) ? 2 : 1; while (upp_interrupt_count < target_int_count && upp_error_count == 0) asm(" nop"); // check buffers (loopback modes only) if (target_int_count == 2 && upp_error_count == 0) for (i = 0; i < sizeof(upp_buffer_a); i++) if (upp_buffer_a[i] != upp_buffer_b[i]) { System_printf("Data mismatch in buffers.\n"); upp_error_count++; } // report test result if (upp_error_count) System_printf("uPP transfers completed with %u errors.\n", upp_error_count); else System_printf ("uPP transfers complete!\n"); GIO_delete(&upph); } }
And test result: