cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 4 MCU

SiCa_3890876
New Contributor

Hi,

I'm using a CY8C4147AZS-S475 microcontroller coupled with a LIN tranciever to communicate on a LIN network. I need to wake-up from DeepSleep condition when there is activity on the LIN network. When the tranciever is in low power mode and detect an activity on the network, it changes the state of the LIN:SCB:rx pin from high to low, when this happen i want the microcontroller to wake up.

I thought to connect an interrupt block to the LIN:SCB:rx pin to generate a wake-up interrupt, but it is not possible from the PSoC Creator.

I also tried to configure a Global Signal block in 'AllPortInt' configuration and set the LIN:SCB:rx pin in interrupt mode but it dosn't work.

Does anyone know how to do that?

Regards

Simone

0 Likes
1 Solution
ShanmathiN_06
Employee

Hello Simone,

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

LINS_SCB_rx_SetDriveMode(LINS_SCB_rx_DM_RES_UP);

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

LINS_SCB_rx_SetInterruptMode(LINS_SCB_rx_0_INTR, LINS_SCB_rx_INTR_BOTH);

// Go to low power mode

CySysPmDeepSleep();

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:

void LINRx()

{

LINS_SCB_rx_ClearInterrupt();

LINS_SCB_tx_ClearInterrupt();

   

}

Also, ensure to use CyIntDisable(0) to disable interrupt and LINS_SCB_tx_Wakeup() to restore the drive modes.

I hope this helps.

Thanks,
Shanmathi

View solution in original post

0 Likes
2 Replies
ShanmathiN_06
Employee

Hello Simone,

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

LINS_SCB_rx_SetDriveMode(LINS_SCB_rx_DM_RES_UP);

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

LINS_SCB_rx_SetInterruptMode(LINS_SCB_rx_0_INTR, LINS_SCB_rx_INTR_BOTH);

// Go to low power mode

CySysPmDeepSleep();

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:

void LINRx()

{

LINS_SCB_rx_ClearInterrupt();

LINS_SCB_tx_ClearInterrupt();

   

}

Also, ensure to use CyIntDisable(0) to disable interrupt and LINS_SCB_tx_Wakeup() to restore the drive modes.

I hope this helps.

Thanks,
Shanmathi

View solution in original post

0 Likes
SiCa_3890876
New Contributor

Thank you very much for the detailed answer, now everithing works properly.

Regards

Simone

0 Likes