cancel
Showing results for 
Search instead for 
Did you mean: 

STR750 IAP using USB problems

daryl2
Associate II
Posted on June 18, 2007 at 09:10

STR750 IAP using USB problems

17 REPLIES 17
daryl2
Associate II
Posted on May 30, 2007 at 01:55

Hi All,

I work with STR750 device and IAR Embedded Workbanch.

My IAP download firmware using the USB port, which is configured as a Virtual COM port. The virtual COM port codes is taken from STR7STR9_USB_developer_kit.

The problems I am seeing is that

1. I am not able to flash the flash memory after I have initialize the Virtual COM port. The flashing will execute and just hangs there. If I switch off my virtual com port before flashing, the flashing will works, but my virtual COM will be disconnected.

2. My user program (an uCOSii RTOS) after launching will hang. I found out that it is due to my Enhanced Interrupt Controller (EIC) initialization (EIC_INIT) in my IAP's 75x_init.s. If I don't perform EIC_INIT, the RTOS will launch and works properly but that will disable my Virtual COM.

I have attached a copy of my project here for referencing. The IAR project consists of the IAP and user program, which is an uCOS II Real Time Operating System (RTOS). It is tested on an IAR STR750-SK evaluation board. Virtual COM part is tested to be working properly.

I will appreciate it if you can help me resolve these problems as it is causing a delay in my project. Thanks

[ This message was edited by: tiger4 on 30-05-2007 05:27 ]

________________

Attachments :

Test.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HtR3&d=%2Fa%2F0X0000000aPy%2FUeWx3zAsgChL3Kvd3mP7mtrwJxPNCGB8LVD.FzUVaZA&asPdf=false
bitterguo
Associate II
Posted on June 15, 2007 at 10:18

Hi, tiger4

I have the similar question.

My target is IAR+Str711+ucos.And ucos code is download form micrium.where I found that ucos has a RAM_liked vectors . It's defined

static BSP_PFNCT BSP_ISR_Table[BSP_NBR_INT]; in bsp.c

My IAP program is based on st's demo.

Application program is located at 0x40002000.

I have modified the xxx_vect.s

app_IRQ_handle_addr equ 0x400030d0 ;this is complied ucos @ ROMStart=0x40002000

LDR PC, Reset_Addr

LDR PC, Undefined_Addr

LDR PC, SWI_Addr

LDR PC, Prefetch_Addr

LDR PC, Abort_Addr

NOP ; Reserved vector

LDR PC, =app_IRQ_handle_addr ; old value is IRQ_Addr

LDR PC, FIQ_Addr

but it doesn't work. :|

daryl2
Associate II
Posted on June 18, 2007 at 00:41

Hi Bitter,

You have make the following changes:

1. Do a software remap of RAM to address 0x00 and copy your exception vector to this area for your uCOS code. For my case, this is done in the str750_cstartup.s79 file.

2. In your IAR for uCOS code, change the download address to 0x40002000. This is found under Project->Options, Download Tab in Debugger.

3. In the str750_flash.xcl of the uCOS code, make the following changes

// Code memory in flash

-DROMSTART=0x40002000

-DROMEND=0x4001FFFF

-DVECSTART=ROMSTART

// Data memory - NOTE RAMSTART is at 0x200000C0, 0x00 - 0xC0 is the area for where your exception vectors are copied to. This value is determine by INTVEC. Build your uCOS code, open the .map file and see how much the INTVEC takes.

-DRAMSTART=0x200000C0

-DRAMEND=0x20003FFF

You can download the Test.zip attachment in my first post for reference on how this is done.

For your IAP, no changes is required in xxx_vect.s. You just need to ensure when you launch your uCOS code from IAP, you provide the correct address (0x40002000)

[ This message was edited by: tiger4 on 18-06-2007 04:13 ]

bitterguo
Associate II
Posted on June 18, 2007 at 00:51

The original post was too long to process during our migration. Please click on the provided URL to read the original post. https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I6XG&d=%2Fa%2F0X0000000bq8%2FeJ1qvMttglbiJf9RrMHb4KnCiggBVFHu2C9VD9XoQ0c&asPdf=false
daryl2
Associate II
Posted on June 18, 2007 at 00:54

For the two problems I am seeing, I solved them by doing the following.

Problem 1:

This is because, USB serial (Virtual COM) is kept being interrupted. In IAP, the interrupt vectors are located in Flash Bank 0. We cannot read and write to the same flash bank memory at the same time. The probelm is solved by disabling the USB interrupt before erasing or writing to flash memory and enabling it back after.

EIC->IER &= 0xFF7FFFFF; // Disable USB interrupt

EIC->IER |= 0x00800000; // Enable USB interrupt

Problem 2:

I found that EIC registers still retained the values used in IAP after launching in my uCOS code. That's why my uCOS code hang as all the vectors are wrong. Hence, I clear all my EIC registersin EIC_DEINIT() function.

void EIC_DeInit(void)

{

u8 i;

EIC->ICR = 0x00;

EIC->CIPR = 0x00;

EIC->FIR = 0x0C;

EIC->IER = 0x00;

EIC->IPR = 0xFFFFFFFF;

// Reinit all SIR register that may have been setup by IAP

for(i = 0; i < 32; i++)

EIC->SIRn[i] = 0x00;

}

daryl2
Associate II
Posted on June 18, 2007 at 01:09

Hi bitter,

Your str712_flash.xcl looks ok.

For your str712_cstartup.s79, RAM_Base is not at 0x0000000, the RAM_BAse for ST712 is at 0x20000000. Do the software remapping after you have copied your exception vectors. Other than these, other areas of str712_cstartup.s79 should remain unchanged

;Copying exception vectors to RAM

LDR r3,=0x40 ; Calculate the vector table size

LDR r0,=0x40002000 ;=FLASH_base

LDR r1,=0x20000000 ;=RAM_base

Loop LDR r2,[r0] ; Read a word from source

STR r2,[r1] ; Copy the word to destination

ADD r0,r0,#4

ADD r1,r1,#4

SUBS r3,r3,#4 ; Decrement number of word to copy

BNE Loop

; Software Remap RAM to address 0x00

MOV r0, #RAM_mask

LDR r1, =BOOTCR_addr ;=CPM_Base_addr

LDRH r2, [r1] ; Read GLCONF Register

BIC r2, r2, #0x03 ; Reset the SW_BOOT bits

ORR r2, r2, r0 ; Change the SW_BOOT bits

STRH r2, [r1] ; Write GLCONF Register

bitterguo
Associate II
Posted on June 18, 2007 at 01:24

My IAP use uart in polling mode for download application program.

I'll check again.

Thank u

BTW: if u have a STR712/711 EVB I'll send my code to you.

It's only use P1.8 for led and uart for ucos_view.

[ This message was edited by: bitter on 18-06-2007 04:57 ]

daryl2
Associate II
Posted on June 18, 2007 at 01:57

Hi Bitter,

My IAP allows downloading of application program either thru UART using polling mode or USB serial.

Sorry, i am using a STR750 EVB.

bitterguo
Associate II
Posted on June 18, 2007 at 02:54

I found if I debug application program with IAR+WIGGLE+h-JTAG (remap to 0x40002000),It runs ok.but when download to 0x40002000 via my bootload.It's shutdown.

I have test my bootloader with other application.it's ok.

the deffacult is ucos port is software intterupt.