2008-09-15 12:15 AM
2008-09-03 07:51 AM
Dear all,
Can anybody explain why the code below works for a ST10F273z4 and the same code, adjusted for the F272, does not work? (it programs the ecu-serial number from the kline-buffer to the flash (in B0F1)) F273 code: ; Select DWPG mov R1,#0x1080 exts #0x0E,#1 mov FCR0H,R1 ; Set data mov RL1,Kline_message_buffer+7 mov RH1,Kline_message_buffer+8 exts #0x0E,#1 mov FDR0L,R1 mov RL1,Kline_message_buffer+9 mov RH1,Kline_message_buffer+10 exts #0x0E,#1 mov FDR0H,R1 mov RL1,Kline_message_buffer+11 mov RH1,Kline_message_buffer+12 exts #0x0E,#1 mov FDR1L,R1 mov R1,#0xFFFF exts #0x0E,#1 mov FDR1H,R1 ; Set address mov R2,#1 ; Msw of address = 1!!! mov R1,#F_ecu_serial_number exts #0x0E,#2 mov FARL,R1 mov FARH,R2 ; Set WMS exts #0x0E,#1 mov R2,FCR0H or R2,#0x8000 exts #0x0E,#1 mov FCR0H,R2 waitfornolock3: exts #0x0E,#1 mov R2,FCR0L jb R2.4,waitfornolock3 jb R2.5,waitfornolock3 F272 Code: ; Select DWPG mov R1,#0x1000 exts #0x08,#1 mov FCR0H,R1 ; Set data mov RL1,Kline_message_buffer+7 mov RH1,Kline_message_buffer+8 exts #0x08,#1 mov FDR0L,R1 mov RL1,Kline_message_buffer+9 mov RH1,Kline_message_buffer+10 exts #0x08,#1 mov FDR0H,R1 mov RL1,Kline_message_buffer+11 mov RH1,Kline_message_buffer+12 exts #0x08,#1 mov FDR1L,R1 mov R1,#0xFFFF exts #0x08,#1 mov FDR1H,R1 ; Set address mov R2,#1 ; Msw of address = 1!!! mov R1,#F_ecu_serial_number exts #0x08,#2 mov FARL,R1 mov FARH,R2 ; Set WMS exts #0x08,#1 mov R2,FCR0H or R2,#0x8000 exts #0x08,#1 mov FCR0H,R2 waitfornolock3: exts #0x08,#1 mov R2,FCR0L jb R2.4,waitfornolock3 jb R2.1,waitfornolock3 Anybody any hints? Regards, Folkert [ This message was edited by: Folkert on 03-09-2008 20:22 ]2008-09-15 12:15 AM
In spite of the fact that the datasheets give the same flashregister access rules for both the F273 and F272 (direct addressing is not allowed), it works for the 273 and not for the 272. Thus when applying the rules completely, it works:
mov R0,#FCR0L exts #0x08,#1 mov R2,[R0] and R2,#0x0012 will give you if the flash is busy... Regards, Folkert