CY Boot Infinite Loop Problem

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

cross mob
Anonymous
Not applicable

Hello I am trying to execute the following code: 

   

int main()
{

   

    /* Initialize ADC. Conversion is not enabled yet. */
    //void ADC_Start();
    CyGlobalIntEnable;
   ADC_Start();
   ADC_IRQ_Enable();
   ADC_StartConvert();

   

    /* Start ADC conversion. */
  for(;;)
{
while(row_count<2u)
{
       CySysFlashWriteRow(row_count,Buffer);
  
}      

   

        for(k=1u;k<2u;k++)
        {
        *readptr = CY_FLASH_BASE + (k*CY_FLASH_SIZEOF_ROW);
        for(byte_count=0u;byte_count< CY_FLASH_SIZEOF_ROW;byte_count++)
          {
          read_data[byte_count] = (*(uint8 *)(readptr + byte_count));
          //byte_count++;
          }
      //  k++;
        }

   

}
}  
          

   

However, after writing and entering the     for(k=1u;k<2u;k++) loop it enters into this while loop which I found from debugging: 

   

 #ifdef CY_BOOT_INT_DEFAULT_HANDLER_EXCEPTION_ENTRY_CALLBACK
        CyBoot_IntDefaultHandler_Exception_EntryCallback();
    #endif /* CY_BOOT_INT_DEFAULT_HANDLER_EXCEPTION_ENTRY_CALLBACK */

   

    while(1)
    {

   

    }

   

Any ideas as to what the problem might be?

0 Likes
1 Solution
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Use the debugger to see if the flash contains correct value. Check the return value of  CySysFlashWriteRow() for success (zero)

   

 

   

Bob

View solution in original post

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

Yes, I have got some ideas. But your code snippet is incomplete, so can you please post your complete project, so that we all can have a look at all of your settings. To do so, use
Creator->File->Create Workspace Bundle (minimal)
and attach the resulting file.

   

EDIT: I just see that you overwrite flash in row 1 and 2 where your program resides.

   

 

   

Bob

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Here you go!

   

 

   

Thanks!

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

read_data[byte_count] = (readptr + byte_count);

   

This line is flagged with a warning, but I would consider clearing that.

   

As a result: Use the upper flash rows. When no bootloader is used and the program not too big they are free.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Hi I am using the upper flash rows indeed. And I cleared the flag as following but am still experiencing this problem:

   

read_data[byte_count] = (*((uint8*)(readptr + byte_count)));

   

Thanks,

   

Rikin

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

Use the debugger to see if the flash contains correct value. Check the return value of  CySysFlashWriteRow() for success (zero)

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Yes, it is writing correctly. However, I was able to fix the problem by making a new project and copying the code over. 

   

Thanks,

   

Rikin

0 Likes