"2.5 Using LIN Slave to Wake up the PSoC 4 Device from Deep Sleep" of KBA225227

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
YoIs_1298666
Level 5
Level 5
250 sign-ins 100 replies posted 100 sign-ins

Hello,

This is a way to enter the LIN slave component in DeepSleep and wake it up from LIN Bus, but It seems that the LIN component is not entered to sleep before executing the CySysPmDeepSleep () API.

In case of PSoC4000S, Is  max 55uA of IUART1 in the figure below consumed in addition to the Deep Sleep current consumption?

YoIs_1298666_0-1625120125244.png

I wonder if l_ifc_ioctl_LINS (L_IOCTL_SLEEP, NULL) should be executed before executing CySysPmDeepSleep ().

Best regards,

Yocchi

 

0 Likes
1 Solution
Ashish
Moderator
Moderator
Moderator
25 likes received 50 solutions authored 100 replies posted

Hi Yocchi san,

I think the flow is correct, but  putting  CyIntDisable(0); before  l_ifc_ioctl_LINS (L_IOCTL_WAKEUP, NULL) ; somehow makes more sense to me. But you can try both approach and see if there is any issue.

Thanks,

Ashish

View solution in original post

0 Likes
7 Replies
Ashish
Moderator
Moderator
Moderator
25 likes received 50 solutions authored 100 replies posted

Hi ,

1) The current  is for active mode or sleep mode, i.e. when UART (SCB)  block is working, and not in deep-sleep (UART block does not operate in deep-sleep, although the Rx pin can be modified dynamically as wakeup- interrupt pin to support wake-up from deep sleep, which is explained in the KBA). 

2) CySysPmDeepSleep () is called for device to go to deep-sleep, so before this is called device is still in active mode. You can execute the l_ifc_ioctl_LINS (L_IOCTL_SLEEP, NULL) to prepare for low-power entry before CySysPmDeepSleep () .

Just to clarify further the point in KBA on wake-up, you have to execute l_ifc_ioctl_LINS (L_IOCTL_WAKEUP, NULL) to wake-up the LIN component, so call this after you receive valid wakeup pulse. As per the KBA, you can configure a timer (to measure the width of valid wake-up pulse). So when ISR is triggered for falling edge then start the timer, and stop it when ISR is again triggered, but now for rising edge. This pulse-width can be checked if it's valid wake-up signal or not (as per LIN spec 2.2A, it should be minimum 150 us). If pulse is valid wake-up, call the api  l_ifc_ioctl_LINS (L_IOCTL_WAKEUP, NULL) to wake-up the LIN component.

Also, for current estimation  you can use the excel sheet- PSoC 4 Power Estimator 

 

 

Regards,

Ashish

 

0 Likes

Hello Ashish-san,

Thank you very much for your help.

Well, To enter DeepSleep using UART as an example, UART_Sleep() API is executed, then CySysPmDeepSleep (). Also, after wakeup with the wakeup trigger, the UART_Wakeup() API is executed as follows.

       UART_Sleep();
      CySysPmDeepSleep();
      UART_Wakeup();

 

In the case of LIN, should I do the following?

       l_ifc_ioctl_LINS (L_IOCTL_SLEEP, NULL);

      CySysPmDeepSleep();

       l_ifc_ioctl_LINS (L_IOCTL_WAKEUP, NULL) ;

 

Best regards,

Yocchi

0 Likes
Ashish
Moderator
Moderator
Moderator
25 likes received 50 solutions authored 100 replies posted

Hi Yocchi san,

I won't suggest to directly do that, instead you need to have appropriate condition first. Because, in UART we can have any activity on Rx line leading to wake-up , but for LIN this is not the case, as per LIN-spec2.2A, there is a requirement of minimum 150us pulse width to wake-up. So first you need to validate first the wakeup- pulse width, and you can use a timer for this .

So if fall-edge occurs- then start timer, and when the rise-edge occur- then stop timer, then using this you get pulse-width. If pulse width>=150us, then wake-up lin by calling  l_ifc_ioctl_LINS (L_IOCTL_WAKEUP, NULL) ;else go back to -deep sleep.

 

Thanks,

Ashish

0 Likes

Hello Ashish-san,

I understand that a timer must be started to calculate the time of the pulse received by Rx before l_ifc_ioctl_LINS (L_IOCTL_WAKEUP, NULL). Is this procedure all right except for the timer start?[KBA was not executing l_ifc_ioctl_LINS (L_IOCTL_SLEEP, NULL).]

   ---------------------------------step------------------------------------

    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

   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   

    l_ifc_ioctl_LINS (L_IOCTL_SLEEP, NULL);

    CySysPmDeepSleep();

    // configure timer and start. If the measured pulse meets the specified time, execute the following to wake up.

     l_ifc_ioctl_LINS (L_IOCTL_WAKEUP, NULL) ;

    CyIntDisable(0);

     LINS_SCB_tx_Wakeup(); 

    LINS_SCB_rx_Wakeup();

    // Return to application

 

Best regards,

Yocchi

0 Likes
Ashish
Moderator
Moderator
Moderator
25 likes received 50 solutions authored 100 replies posted

Hi Yocchi san,

I think the flow is correct, but  putting  CyIntDisable(0); before  l_ifc_ioctl_LINS (L_IOCTL_WAKEUP, NULL) ; somehow makes more sense to me. But you can try both approach and see if there is any issue.

Thanks,

Ashish

0 Likes

Hello Ashish-san,

I am very grateful for the clear advice.

I have previously confirmed that LINS_SCB_rx_SetDriveMode (LINS_SCB_rx_DM_RES_UP) does not work with the same settings on the UART.

Best regards,

Yocchi

0 Likes
Ashish
Moderator
Moderator
Moderator
25 likes received 50 solutions authored 100 replies posted

Hi Yocchi san,

 

Thanks for the feedback. Are you facing any  issue with LINS_SCB_rx_SetDriveMode (LINS_SCB_rx_DM_RES_UP) ? It will just enable the internal resistive pull-up on the pin. Anyways please try the full code, and if any issues, let us know.

 

Thanks,

Ashish

0 Likes