Never mind I found the issue it was in my Write SCI routine, below I received from terminal after correcting a mistake I made with data && 0xFF instead of data & 0xFF.
Hex Result: 4800
Hex Result: ABAD
Hex Result: 7E57
Hex Result: ABAD
Hex Result: 7E57
Hex Result: 48
Chip is VS1053
I have run into another issue where the plugin starts loading and then stops after a number of seconds and doesn't seems to move onto the next line and the PIC no longer goes into a timer interrupt routine which I've used to toggle a pin. I've also printed a line before and after the plugin load but only the line before is shown. Watchdog timer has not been enabled for this.
Code: Select all
printf("Loading Plugin!\r\n");
LoadPlugin(plugin, sizeof(plugin)/sizeof(plugin[0]));
printf("Finished!\r\n");
Hex Result: ABAD
Hex Result: 7E57
Hex Result: ABAD
Hex Result: 7E57
Hex Result: 48
Chip is VS1053
Loading Plugin!
Below is load plugin routine.
Code: Select all
void LoadPlugin(const u_int16 *d, u_int16 len) {
int i = 0;
while (i<len) {
unsigned short addr, n, val;
addr = d[i++];
n = d[i++];
if (n & 0x8000U) { /* RLE run, replicate n samples */
n &= 0x7FFF;
val = d[i++];
while (n--) {
WriteSci(addr, val);
}
} else { /* Copy run, copy n samples */
while (n--) {
val = d[i++];
WriteSci(addr, val);
}
}
}
}