Program starts successfully after device is programmed using the

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

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hi,

   

 

   

I am using the CY8CKIT-049-42XX PSOC 4 prototyping kit to develop a program to control a RN171 wifi module (http://www.microchip.com/wwwproducts/Devices.aspx?product=RN171), the program uses the following interrupts.

   

1. Timer 1

   

2. USART (USB -Serial )

   

3. USART (Tx-P1.3,Rx-P1.4)

   

 

   

The program works very well as expected when programmed from the host bootloader , all the interrupts are received correctly.

   

However when the prototype kit is powered up from an external power supply, the program just hangs up, and does to come to the for(;;)  loop, this I know because pressing the push button does not bring the kit into program mode (LED does not flash), but when the same is done after programming from the host bootloader the kit comes into program mode when the push button is pressed.

   

Please see the attached workspace bundle for reference.

   

The main file code and the timer1 interrupt handler is given below,

   

 

   
    


int main()
{   
    int a;
        
    /* Enable the global interrupt */
    CyGlobalIntEnable;
    
    //TimerISR_Start();
    TimerISR_StartEx(InterruptHandler);       
    //TimerISR_Enable();
    
    Timer_1_Start();       
    PCUART_Start();
    HC05UART_Start();
    
    
    LED_Write(0);
    
    //configure as web client

    

    InitNetworkProfiles();
    
    RN171IdleTime=200;
    //RN171WifiJoin.Task=RN171WIFIJOIN_INIT;
    
    //transfer uart data to wifi
    //RN171UARTMode=2;
   
    
    Control.Task=1;
    PCUART_UartPutString("started\n\r");

    


    
    for(;;)
    {      
               
        application();
       
        
        if(!SW1_Read()) {
            LED_Write(1);
            CySoftwareReset();
        }

    


        
    }
}

   
   

/*******************************************************************************
* Define Interrupt service routine and allocate an vector to the Interrupt
********************************************************************************/
CY_ISR(InterruptHandler)
{
    /* Read Status register in order to clear the sticky Terminal Count (TC) bit 
     * in the status register. Note that the function is not called, but rather 
     * the status is read directly.
     */
       Timer_1_STATUS;
    //Timer_1_ClearFIFO();
    //TimerISR_ClearPending();
    
    //timer interrupts at 2 msec ticks
        //ThwScanTimeout++;
    
    RN171WaitTimeout++;
    RN171ScanTimeout++;
    
    if (RN171RcvCntr!=0){

   

        RN171RcvTimeout++;
        if (RN171RcvTimeout>RN171IdleTime){
                             
            RN171RcvLen=RN171RcvCntr;
            //clear timeout condition
            RN171RcvCntr=0;
            RN171RcvTimeout=0;
            
            //set ready flag
            RN171DataReadyFlg=1;      
        }
    }
    
   
    //timeout, also triggers data ready flag indicating packet is ready
    if (UARTRcvCntr!=0){

   

        UARTRcvTimeout++;
        if (UARTRcvTimeout>BTH_IDLE_TIMEOUT){
                             
            rcvlen=UARTRcvCntr;
            //clear timeout condition
            UARTRcvCntr=0;
            UARTRcvTimeout=0;
            
            //set ready flag
            UARTDataReadyFlg=1;      
        }
    }              
}

   

Could anyone help me please???, I am sure something basic is missing here...

   

thanks

   

a

   
    

 

   
0 Likes
4 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

"Smells" strongly like a power problem. Have a look into the schematic, so that you make sure there is no issue when applying power.

   

 

   

Bob

0 Likes
Anonymous
Not applicable
        Thanks for the reply, The board is powered by a separate +5 vdc power source, the USB data and the ground pins are only connected to the computer. The external power source is derived from a cell phone charger. Do I have to connect the +5 v pin of the USB terminal (Programmer) as well? Thanks a   
0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

A cellphone charger usually does not deliver power with the needed stability. Consider using a LDO regulator powered by the charger.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Thanks for the help.

   

I intend to use a LM2576 DC-DC converter in the final version of my project, 

   

 

   

thanks

   

a

0 Likes