Tool/software: TI C/C++ Compiler
Dear all,
I'm facing a really weird problem and I'm starting to suspect that the problem is in clpru compiler. Let me explain.
I have a program that implements the PDI protocol used to program some XMEGA microcontrollers devices. I'm using the PRU shared ram to pass contents from/to PRU/Processor, the full code is here [1]. Basically what the code does is, the ARM writes a command to shared_ram[0], the PRU is polling shared_ram[0] and when sees a command handles the command and sends an interrupt to the ARM indicating that the command is handled.
The test program that I'm using simply writes the CMD_READ_SIGNATURE to the shared_ram[0] and waits for the PRU, the problem is that the interrupt from the PRU is never received.
Another thing I did is apply the patch below [2], the patch simply removes the code of the other commands, note that the commands are not used for the ARM side (it only sends the CMD_READ_SIGNATURE) so for the flow of the program doesn't matter if these commands are there or not. By my surprise with this commented the PRU sends the interrupt and I'm able to read the signature from the XMEGA microcontroller.
So the question is, what I'm doing wrong ?
[2] pdi.c
@@ -81,6 +81,7 @@ int main(int argc, const char *argv[]) { shared_ram[2] = dev_id[2]; } break; +#if 0 case CMD_CHIP_ERASE: xnvm_chip_erase(); break; @@ -111,6 +112,7 @@ int main(int argc, const char *argv[]) { xnvm_init(); xnvm_erase_program_flash_page(0x0000 + shared_ram[1], page_buffer, BUFSIZE); break; +#endif default: break; }
Thanks in advance