Please replace static uint8_t glEp0Buffer; with uint8_t glEp0Buffer __attribute__ ((aligned (32)));
Also, you can't directly change the IO matrix at run time while UVC application thread is already using the GPIF, UART, GPIO and I2C. The UVC applications needs to be stopped including the GPIF state machine and all the blocks need to be de-initialized an
To re-configure the IO matrix, you will have to firstly de-enit the GPIF, UART, GPIO and I2C and then change the IO matrix config to use SPI and I2C and then re-Initialize them.
So, before enableSPI(), you will have to do the following:
1.) Disable GPIF using CyU3PGpifDisable(CyFalse);
2.) Disable GPIO block using CyU3PGpioDeInit();
3.) Disable I2C block using CyU3PI2cDeInit();
4.) Disable UART block using CyU3PUartDeInit();
Every block of the FX3 needs to be de-initialized and then re-initialized accordingly after the IO matrix is modified.
Please do the following and share your findings.