Do not forget that every write to the SPIM causes a byte to be sent back that you have to read off. It seems that the logic depending on the bytes read from SPI do not reflect that.
Keep in mind that the SPIM has got 2 FIFO buffers, so there is no need to wait for the transmission is done except you want the ss-signal to toggle. Writes to SPIM are blocking until there is room in the buffer.
Some other points I would suggest you to change:
Do not define loop variables as global (outside main() ) this may lead to an error easily.
The interrupt handler within isr_2 is clobbered, one of the special comments has been deleted by accident
The interrupt routine in isr_uart is fairly long and contains delays. This is something you should strongly avoid. Interrupt handlers work bet when they just remove the interrupt cause and set a flag on which the main-loop reacts on.
There is a different (safer) way to write interrupt handlers that avoids changes in the generated files which can be overwritten accidently, have a look (search) for CY_ISR and CY_ISR_PROTO in the "System Reference Guide" to be found from Creator's Help.