Does the whole system hang, or just the task calling that function. If the whole system, and you pause on the debugger, what is executing? If just that task, and you step into the function in the debugger, how far does it get?
Following is the call stack when I break,
Looks like exception happen and not handled.
maybe more init need to do before call them but not sure what is it.
XPA.elf! Dummy_Handler Line: 221
XPA.elf! Line: 221
XPA.elf! PendSV_Handler Line: 307
XPA.elf! Line: 307
XPA.elf! xQueueGenericReceive (xQueueHandle pxQueue, void * const pvBuffer, void * const pvBuffer@entry, portTickType xTicksToWait, long xJustPeeking, long xJustPeeking@entry) Line: 1093
Is the rest of your system functioning as expected (tasks switching, tick count incrementing) if you don’t call freertos_twi_write_packet() anywhere? Do you have the TWI interrupt installed? Do you have configASSERT() defined?
Comment out freertos_twi_write_packet() my code runs well.
The symptom is waiting for transmission complete forever. I think TWI interrupt is inside freertos_twi_master.c. I do add the following code before freertos_twi_master_init but still same result.
PS: I do change my code from TWI0 to TWI1. Because according to Arduino due, TWI1 has pull up resister but TWI0 no.
Do you really have TWI1_Handler defined somewhere ? That’s the required interrupt handler. Usually it‘s set up as interrupt handler (in exception table) by default as weak symbol which is aliased by Dummy_Handler if it‘s not defined in application code.
I just want to update the status.
I still cannot make freeRTOS work but my problem solved.
I add the following into conf_board.h and my Wire Library port from Arduino IDE to Atmel Studio 7 work.