This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to disable UART Tx

Other Parts Discussed in Thread: CC2530, Z-STACK

I'd like to disable UART Tx when CC2530 is going to 'PWRMGR_CONSERVE' state.
How can I disable UART Tx?

Detail:

- I use CC2530ZDK.

- I use osal_pwrmgr_task_state(My_App_TaskID, PWRMGR_CONSERVE); 
   see http://e2e.ti.com/support/low_power_rf/f/158/t/153290.aspx#555159 

- Before going to conserve state, I use 'HalUARTSuspend();'

- Even when ED is the conserve state, UART Tx (P0_3 pin) is high(=3.3V out).
  And in my system, it causes the electric leak.

- I found the function 'HalUARTClose()' in HAL Drivers API (SWRA193).
  But it isn't implemented. (Z-stack 2.5.0, IAR workbench 8.10.3) 

- I study 'CC253x User's Guide' (SWRU191B) and 'Using UART in CC253xFx' (DN112).
  And I found the correspond registers; P0SEL, P0DIR, P0, P0INP.

- I added the code to change the registers when state change. But it did't work.
 UART Tx remained to be High. It was opposite of my intention.

Here is the code:

// Go into the conserve state:

      HalUARTSuspend();
P0SEL &= ~0x0c;
P0DIR &= ~0x08;
P0 &= ~0x0c;
P0INP |= 0x0c;
osal_pwrmgr_task_state(TaskID, PWRMGR_CONSERVE); 
      break;

 // When back to HOLD state:

      osal_pwrmgr_task_state(RemoteCamClient_TaskID, PWRMGR_HOLD);
P0SEL |= 0x0c;
P0DIR |= 0x08;
P0INP &= ~0x0c;
HalUARTResume();
      break;

Question
1. How can I disable UART Tx ?
2. If I can, I'd like to disable UART Rx, too. How ?
3. If my scenario above is not well, I'd like to use 'HalUARTClose()' function.
Please teach me the implement of the function.

Regards. 

  • Hi,

     

    These configurations looks alright, maybe the serial interface

    pulling this pin to high?

    Here's what I suggest you to do:

    Naoki Fujiwara said:

    // Go into the conserve state:

          HalUARTSuspend();
    P0SEL &= ~0x0c;
    P0DIR &= ~0x08;
    P0 &= ~0x0c;
    P0INP |= 0x0c;
    osal_pwrmgr_task_state(TaskID, PWRMGR_CONSERVE); 
          break;

    Place a breakpoint before the execution of these lineד, also place 3 or 4 asm("NOP");

    after the osal_pwrmgr_task_state(TaskID, PWRMGR_CONSERVE); and add a

    breakpoin on the last asm("NOP");

    While debugging, once the debugger stops on the first breakpoint, disable the serial

    port (preferably unplug the serial cable too), then let it run to the second break point,

    now check the level of the Tx pin, is it still "high", or somewhere in the middle?

    You may also try to configure this pin as an output with defined level (Low) and measure

    for the actual level on the output.

     

  • Hi,

    Igor Sherer said:

    Place a breakpoint before the execution of these lineד, also place 3 or 4 asm("NOP");

    ...

    now check the level of the Tx pin, is it still "high", or somewhere in the middle?

    I debugged like your suggestion with SmartRF05EB which has RS232C interface chip. 

    Tx pin remains high at both breakpoints...

     

    I notice your advice is to the point.

    Igor Sherer said:

    These configurations looks alright, maybe the serial interface

    pulling this pin to high?

    I changed the target to SmartRF05BB, which has not RS232C interface. Tx pin isn't connected to any chip.

    Then Tx pin went to almost low at second breakpoint. Tx pin seemed high-impedance.
    That is good for me.

     

    I also tried to the pin as low-output. It went good too.

    Igor Sherer said:

    You may also try to configure this pin as an output with defined level (Low) and measure

    for the actual level on the output.

     

    Thank you for your good advice so much.

  • Hi,

    You are welcome.

    By the way, may be the LCD is pulling this pin to high, I'm not sure though,

    you can check the connections in cc2530ZDK, schematic section.

    Anyhow, if this answers your question, please verify it, thank you.