The application uses two on board instances of LPSPI, one in master configuration and the other one is slave to communicate data via the SPI bus. Data will be gathered periodically from the ADC input and will be sent to the master device which transforms it into a PWM signal. In this way the potentiometer controls the LED intensity.
I have tested this routine and the waveforms tested by the oscilloscope are all working fine!