Dear Sirs, Mr. Coppi! ...I use the CAN-Module of a CA-step. Because everything was fine using the Board, I burned it without looking at the errata sheed...I was surprised at the result! Now I want to please You help me avoid another mistake. The behavior can be avoided if a message object is not updated by software when a transmission of the corresponding message object is pending (TXRQ element is set) and the CAN module is active (INIT = 0). Does that mean, if I would disable the CAN module each time I change something (data) in an object and enable it after that everything will be o.K.? The nodes in the CAN system ignore the remote frame with the identifier=0 and no data frame is triggered by this remote frame. Is this another or additional possibility? Is there a way to disable only the identifier '0'? I'm not so sure if I did understand the errata well, so please don't wonder about this questions. Do You know about a distributor who could have a flash device of the C164? (It's really expensive for me to burn them so often and this could prevent al least wrong startup configurations other mistakes which are not step-specific?!) Thanks a lot for helping me hannes P.S. why differs the behaviour using the RAM of the Board instead of OTP??
Hello again! I'm sorry, I think i was wrong with that preventing the CAN from accepting ID '0' by mask out bit 11 of abritation register ( i meant global mask)... But what is the global mask good for? If bits in global mask are set, they will be masked with incoming messages (all are accepted first and then selected by the object ID). If a '0' bit in global mask will ignore respective incomming bits like "don't care", but after that they will nevertheless be compared with object ID. So why global mask? Is it just to prevent the CAN controller for comparing incoming ID's with Object ID's by filtering incoming messages first? And how have i to understand the errata? If there is no ID=0 this CAN-error should never happen? But it does!? hannes
Ciao Hannes, you are mixing a lot of confused ideas... 1) Your reference source should ever be THE MANUALS - Keil for Software, Infineon for Hardware. 2) I repeat, you told me that you have an application that works when placed in RAM, so FORGET the errata sheet (temporarily..), if your application is working in RAM, it is UNLIKELY you are running into errata sheet problems! About Mapping: basically any microcontroller has two main memory spaces: ROM and RAM; ROM will contain the NONVOLATILE program part (CODE and CONSTants), while RAM will contain the DATA. Going into further detail, each of these spaces can be divided into logical sections, each of them having some characteristics, defined by the "environment", where for "environment" i mean the Compiler Architecture and the Microcontroller Architecture and Instruction Set. During Compiler Specification phase, the Compiler writer (Mr. Keil) studies the Microcontroller Instruction Set and decides how to best use it to obtain the "optimum" code during compile. In case of C164, the ROM memory area is split into CODE and CONST classes, then the CODE class is further divided into NCODE (NEAR CODE) and FCODE (FAR CODE). NEAR CODE means that code uses NEAR CALLS and NEAR RETURN of C164 Instruction Set, these are instructions that use only 16bit displacement and thus works only INSIDE of the SAME 64K memory segment. If you need to call or jump to code contained into a different 64K segment, you must use FAR CODE, using FAR CALLS and FAR RETURN, which are instructions that use 24 bit displacement. This same situation occurs for CONST classes: NCONST is a class the compiler accesses by means of a single preset DPP register, so it can be at most 16K wide. If you need more CONSTants, you must place them in FCONST or HCONST sections. The compiler generates different instruction sequences to access the different sections, this way you can choose to place some CONSTants into a small section that can be accessed very quicly and some other in a larger section that can be accessed slower. If you are "crazy" enough (or if you know what you do, in some special case...), you can decide by yourself where to place each piece of code you write, like
void far MyFarFunction (void) .... or unsigned int huge MyHugeVariable;
http://www.keil.com/support/man/docs/l166/l166_memory.htm
Hello again, about C164 clock: step CA was still using the Port 0 configuration for clock multiplication setup. The software method described in the new manual is valid since step DA. For step DA I modified my startup code this way to change PLL multiplication factor.
?C_RESET PROC TASK C_STARTUP INTNO RESET = 0 ?C_STARTUP: LABEL Model $IF (WATCHDOG = 0) DISWDT ; Disable watchdog timer $ENDIF ; BC MODIFICATION - BEGIN PLL CLOCK SETUP MOV R15,#09B00H MOV RSTCON,R15 EXTR #1 MOV SYSCON2,#00500H EXTR #1 MOV SYSCON2,#00400H ; BC MODIFICATION - END BCON0L SET (_MTTC0 << 5) OR (_RWDC0 << 4) BCON0L SET BCON0L OR ((NOT _MCTC0) AND 0FH) BCON0L SET BCON0L AND (NOT (_RDYEN0 << 3)) BCON0L SET BCON0L OR (_RDY_AS0 << 3)
Hello! ..i read about Memory Organisation in manual: internal ROM area is located in: 0x00 to 0x7FFF. That means that section is only for reading and Program execution!? The sfr and RAM area is located in 0xF000 to 0xFFFF, where writing and reading is allowed, i think.? Is this correct: if i want to check the real behaviour i have to configure the memory map in simulator like this- and let run the program? Would be nice, You could answer again! Best regards hannes
...and that is the Memory map of the map file: MEMORY MAP OF MODULE: ARNE2-270205_CA (HIWI_CAN) START STOP LENGTH TYPE RTYP ALIGN TGR GRP COMB CLASS SECTION NAME ===================================================================================== 000000H 000003H 000004H --- --- --- --- --- --- * INTVECTOR TABLE * 000004H 000005H 000002H XDATA REL WORD --- --- GLOB --- ?C_INITSEC 000008H 00000BH 000004H --- --- --- --- --- --- * RESERVED MEMORY * 00000CH 000011H 000006H CONST ABS WORD --- --- PRIV --- ?C_CLRMEMSEC 000088H 00008BH 000004H --- --- --- --- --- --- * INTVECTOR TABLE * 000090H 000093H 000004H --- --- --- --- --- --- * INTVECTOR TABLE * 0000ACH 0000AFH 000004H --- --- --- --- --- --- * RESERVED MEMORY * 000100H 000103H 000004H --- --- --- --- --- --- * INTVECTOR TABLE * 000104H 0001C1H 0000BEH CODE REL WORD --- --- PRIV ICODE ?C_STARTUP_CODE 0001C2H 00049BH 0002DAH CODE REL WORD --- --- PUBL NCODE ?PR?HIWI_CAN 00E000H 00E1FFH 000200H DATA REL WORD --- --- PUBL NDATA ?C_USERSTACK 00E200H 00E20FH 000010H DATA REL WORD --- --- PUBL NDATA0 ?ND0?HIWI_CAN 00FB00H 00FBFFH 000100H --- --- --- --- --- --- * SYSTEM STACK * 00FC00H 00FC1FH 000020H DATA --- BYTE --- --- --- *REG* ?C_MAINREGISTERS ...the Target Classes, defined in Keil is: ICODE (0x0-0x7FFF), NCODE (0x0-0x7FFF), NCONST (0x0-0x7FFF), NDATA (0xE000-0xE7FF, 0xF600-0xFDFF), NDATA0 (0xE000-0xE7FF, 0xF600-0xFDFF), option is 'using Memory Layout from target dialog' Probably i'm wrong, but the DATA section should start at 0xF000 and end at maximum 0xFFFF???? (User manual v3.1,[3-2],line 2). How is it to define those sections, i used what i've got. If all this gets on Your nerves, ignore it! hannes
...tihs is the MAP contents of µVision debugger: MAP 0x00000000 - 0x00000003 exec read 0x00000004 - 0x00000007 read write 0x00000008 - 0x0000000B exec read write 0x0000000C - 0x00000011 read 0x00000012 - 0x00000087 exec read write 0x00000088 - 0x0000008B exec read 0x0000008C - 0x0000009F exec read write 0x000000A0 - 0x000000A3 exec read 0x000000A4 - 0x000000AF exec read write 0x000000B0 - 0x000005C9 exec read 0x000005CA - 0x0000DFFF exec read write 0x0000E000 - 0x0000E207 read write 0x0000E208 - 0x0000FFFF exec read write Should write access be enabled benath address 0xF000? Bye
Hello Hannes, please try to better read the Manuals and the Datasheets; the C164, before step DA, has only 2K of RAM, located F600-FDFF. STOP. If you try to allocate segments in the space E000-E7FF, they are allocated into nowhere. Area F000-FFFF is the address area left by C164 designers to be internally used for Register and RAM, but this does not mean that it is ALL used; some registers are F000-F1FF, some others are FE00-FFFF; on some C16x derivatives, there is internal RAM from F200 to FDFF, on C164 is just 2K F600 to FDFF.
Dear Mr.Coppi-it's me again.. Sorry, i became a little lazy knowing You are there kind of a speaking/writing book... but also did not think and know about the things that were done by KEIL ide automaticly case-tool-like... I looked at the manual v1.00 ( because CA-step is indexed by 8EM: The descriptions in this manual refer to the following derivatives of the C164-class: l C164CI-8EM Version with 64 KByte on-chip OTP memory ...correct?? Following given addressranges i found: 0x0000-0x8000 :lower 32kB OTP 0xEF00-0xEFFF :CAN !!! is this wrong? You wrote:If you try to allocate segments in the space E000-E7FF, they are allocated into nowhere.!!! 0xF000-0xF1FF :esfr 0xFE00-0xFFFF :sfr 0xF600-0xFDFF :RAM 0xE000-0xF000 :XRAM + CAN !!!!!same question as above!!!!!!!!! (Does there exist exact tables of Memory organization for all the Steps?) These values i wrote into the Memory Map and tested. Programm "crashed" (error message appeared), because indirect addressed Memory at address 0xE200 was accessed. Looking at the device database the Memory is defined at these addresses:CPU=IRAM(0xF600-0xFDFF) XRAM(0xE000-0xE7FF) CLOCK(20000000) IROM (0-0xFFFF) ICAN(0xE800-0xEFFF) MOD167 I could define a new C164CI_CA e.g. to avoid the wrong accesses, i think???! I'm sorry, but don't really know where to find the exact Memoryorganization of CA step. Please could You help again? hannes
I don't know anything about the C164 but for the C167, I had to enable the XRAM before I used it,
MOV XPERCON,#0403H ; Enable CAN 1 and CAN 2 Xbus peripherals ; Enable XRAM 2 KByte memory ; Disable XRAM 6 KByte memory NOP NOP MOV SYSCON,#8184H ; Stack size = 512 words ; Internal rom starts at 00'0000 ; Segmentation enabled ; Internal rom disabled ; BHE pin enabled ; Clock out pin enabled ; WR is write low, BHE is write high ; Xbus peripherals are enabled ; Xbus accesses are not visible on external bus ; Xbus peripherals not accessable on external bus
Dear Mr. Coppi! I changed a copy of the C164CI in the Data Base. Now it works in Flash too!! Sorry because my Questions were thoughtless- i'm a bit stressed at the time and was somewhere else...nevertheless i feel like asking You again to be sure if it's right, before i burn it. The Memory, i allocated in the Data Base, is this: 0x0000-0xFFFF := internal ROM 0xF600-0xFDFF := internal RAM 0xE800-0xEFFF := CAN area no XRAM!! I wondered, because in every UM i found XRAM at E000-F000 (e.g.at System Memory Map)!? Would be nice if You answer me!? hannes
Hi Brad, the C164 is older than other C16x derivatives so the XPERCON register is not present, you just have a more generic bit XPEN in the SYSCON register used to enable/disable XRAM (when present) and CAN.
Hello Hannes, The correct memory map should be: 0x00000-0x07FFF := internal ROM 0x18000-0x1FFFF := internal ROM 0x0F600-0x0FDFF := internal RAM 0x0EF00-0x0EFFF := CAN area You wrote: I wondered, because in every UM i found XRAM at E000-F000 (e.g.at System Memory Map)!? That address area is just a 4K area left by Infineon designers for XPERIPHERALS; what REALLY IS inside that area depends on the C16x derivative, so you must consult the DATASHEET to have a precise indication about how that area is filled with peripherals. The USER'S MANUAL is GENERIC for the C164 family, the DATASHEET integrates the MANUAL with informations SPECIFIC to your C164 derivative (C164-CI 8EM). I think that your OTP has good chances to work correctly, this time, let me know. Ciao Bruno
Mr. Coppi! Good News at last!: After patching the Hardware everything works fine now! I'm really thankfull to You. I guess i need to post further Questions sometimes, and hope i again will hear from You!? Best regards hannes