In order to use LIN Rx pin as wake-up source, you need to configure it as interrupt pin, using system reference and pin APIs.
You can refer to the code snippet below. When the Rx line is pulled LOW, the device wakes up from deep sleep.
The LINS_SCB_rx APIs are used to configure Rx pin for interrupt.
Parametre 0 in CyIntEnable(0) indicates the interrupt number of the GPIO port. For eg, if Rx is assigned to port0, then IRQ number is '0'.
You can refer to Interrupt sources section in architecture TRM to check IRQ number (http://www.cypress.com/file/280681/download).
LINS_SCB_tx_Sleep(); // this will backup the drive mode
LINS_SCB_rx_Sleep(); // this will backup the drive mode
CyIntEnable(0); //IRQ0 for GPIO port 0; enable interrupt for the pin
CyIntSetVector(0, &LINRx); //IRQ0 for GPIO port 0 and address of function that needs to be handled when interrupt is detected
// Go to low power mode
The interrupt needs to be cleared when it is triggered. The address of this function should be assigned to the interrupt vector of GPIO port. CyIntSetVector is used to assign the address of custom function to an IRQ.
The address of LINRx(), a custom function, is passed to CyIntSetVector and LINRx() is defined as follows:
Also, ensure to use CyIntDisable(0) to disable interrupt and LINS_SCB_tx_Wakeup() to restore the drive modes.
I hope this helps.
Thank you very much for the detailed answer, now everithing works properly.