Hi Everybody, I'm experimenting with Infineon's XC161CJ-controller on an Infineon SK-XC16x starter kit. Most of my routines work now, except the I2C-routines. Sending of data works OK, but the errors occur when I want to receive data. Has anybody on this forum written I2C-routines for this controller? And if so, are you willing to share them? Thanks in advance. :) Kind Regards, Dennis Ebben
Hi Dennis, I am currently working with the XC161CJ & the I2C Module. I am using the routines generated by 'Dave'. Haven't got it working yet though... Are you willng to share your code ?, maybe we can help eachother out. Regards, Rolf
Hi, I am FAE for Micro in Germany. I got the following feedback from our end costumer and think it may be usefully for you. Concerning the DAvE generated files there seems to be a "ugly" point. I translate the original message: "Concerning the I²C-interface there are two interrupts 'protocoll' and 'data' interrupt." The costumer was wishing only the data interrupt, "BUT DAvE is generating a interrupt handler for data interrupt with a JUMP to PROTOCOLL interrupt !" If you have first look at the generated code this not visible for you, because both interrupt vectors lay directly each one the other in memory. The first 'data interrupt ' mis initialized by the compiler with twice 0xFFFF what is equal to BSET R15, bit 15. If a data interrupt occurs than twice a BSET R15, bit 15 is executed, before the generated ISR handler is called." The costumer had not selected the register bank switch and so the register R15 was not saved (by the way: it was not used by handler routine). "What exactly happened ? All things went fine, but from time to time the most upper bit of R15 was changed to '1', what is not noted the first view, because this bit is used very seldom. Only if the compiler assume (assign ?) in function the register R15 a word variable (this istoo very seldom) the suspectly errors occur." To find this we needed 2 days. Than we noted an other thing. You need under some circumstances a extra dummy access to read back with the I²C-module. OK, that's is all I know about this, but may be it can help you to find the wrong code sequences. MESSAGE: Do not believe the DAvE can all do for you! We at this time work on a DAvE bug list. (Yes we really found some DAvE bugs ) The second: The I²C module was tested - I had contact to the developer and the test engineer, but with the hardware implementation there are some difficulties. Stefan
Hi Stefan, thank you for your comments in this matter. It seems as 'Dave' is mixing up the data & protokoll interrupt. by adding: // USER CODE BEGIN (I2C_Header,9) #undef I2C_INT_D #undef I2C_INT_P #define I2C_INT_D 0x40 #define I2C_INT_P 0x41 // USER CODE END it works much better, but still makes some errors. (an extra byte is transmitted sometimes). I have given upp using the dave routines and makes my own, polling approach instead of using interrupts. btw. seems as after accessing RTBL there is a slight delay before the IRQ_D bit is cleared? regards, Rolf
Hi Rolf, may be that is this experience I meaned with the extra dummy access we had taken as I mentioned. I will ask my end costumer, if it is possible to that you may contact him by e-mail or that I can transfer the I²C routines. He is a very good minded and helpfull men, but because some reasons I want not to give his contact address directly. But I think it would be very usefully that you can change some experinece - may be your information is new for him. I would only ask to be so kind to hold me in copy if I can make the contact, because the support is my job. So all information I can get , are usefull to me. Stefan
If you want direct contact with me, you can email me at: mybuddy(at)sverige.nu. (I check this email address only occasionally). /Rolf
Hi Rolf, I have mailed you a low level driver I got from Infineon directly. This was helpfull to my end costumer and may it helps you too. Please have look at your e-mail. Stefan
Hi Rolf and Stefan, Last week, I haven't been able to read this forum anymore, so I saw your threads today and think it's very interesting. Thanks for the information you've shared. I wrote code for Infineon's C161RI/PI two years ago and that code works OK. At that time, I also had problems with my read-routine at that time, because I didn't notice that a dummy read was necessary to re-activate the bus (after sending the slave address to the bus). A few weeks ago, I've found an Application Note (AP1631), called: "Migration from C161/C164 Microconrollers to the XC161/XC164" (version 1.0, April 2000) Paragraph 3.9 describes the IIC-bus. It describes the registers that have to be renamed and also other actions that have to be token, because of the things that are new in the XC161. I used this Application Note to write my XC161 I2C-routines and the send-routines worked immediately. But something goes wrong in the read-routines, as I mentioned before. The dummy read is in the read-routine, so that isn't the problem. Stefan, do you want to share the code you received from Infineon with me? That probably would be very helpfull to me, because I think it's a little thing that causes my not-working read-routine. You can reach me at: info@frankort.com If you would like to, I'm also wanting to share my routines. What DAvE concerns: I also used DAvE two years ago and the first thing I noticed, was that the I2C-routines weren't usefull. They were just macro's to set a register value and not more than that. That was the reason I decided to write my own routines with a little help from information I've found on Hitex' site (they have very interesting documentation about the C167V1-family of Infineon). Kind regards, Dennis Ebben
Hi Dennis, there is no problem to mail the driver to you. Second I 've forgotten to mentioned: since approximately march or april there was a new manual available for XC161 and one of the most experienced guides from Infineon told me the I²C should be more covered there. It is downloadable at infineons web page , if you have not done yet. Let me know whether this was helpfull to you. (At all the code was usefull) Stefan Please have a look at your mail in 10 - 20 minutes it comes as an zip-file.
Hi Stefan, I studied the code you sent me and found the solution. The order in which I toggled bits from several registers wasn't right. For Example: In the old C161 I set the INT-bit after the dummy-read. That seemed to work OK. But in this controller it has to be set before the dummy read. Same for some other bits/registers. So, your code was very helpfull to me!!! I solved the problem in the routines I had written. Thanks again! :) Kind regards, Dennis Ebben
Hi Dennis, it is very good for me to hear I was able to help you with this code. I had only one additional reserve in background in case of problems with reading back. My costumer was lucky too with this code as I told. It is a little bit pitty that Rolf did not answer. As you know I send him the code too. OK- but important is, that you had solved the problem, so I am quite happy. Stefan
Dear Dennis & Stefan, sorry about the response delay, but I had to focus on some other matters. I have given the code a short glimps, and I think it will be helpful for me when I continue working with the IIC-Code. I got the routine I was working with at the time up and running before I recived your email Stefan, but I am grateful for your assistance,maybe I'll come back to you later regarding this... Best regards, Rolf
Hi Stefan and everybody, sorry for not english language, i have problems with it :-( Hallo, Stefan, ich beschäftige mich momentan ebenfalls mit dem I2C-Modul beim XC161-Controller und habe die gleichen Probleme die in diesem Forum vor einem Monat diskutiert wurden. Es funktioniert zwar, aber mit komischen Effekten. Bisher habe ich weder Application Notes noch funktionsfähige C- bzw. Assembler-Routinen gefunden. Ich habe in Forum gelesen, dass Du einige hattest. Ich wäre Dir sehr dankbar sein, wenn Du mir diese an igoreq@web.de zukommen lassen könntest, weil ich nirgendwo im Internet Hilfe zu diesem Thema finden kann. Vielen Dank im voraus. PS Ich habe keine Deine E-Mail Adresse, deswegen deswegen muß ich diesen Berich im Forum veröffentlichen.
Hallo Igor, ich sende Dir den Low-Level-Treiber zu. Bis jetzt hat er geholfen. DAvE generiert die Routinen uebrigens falsch. Stefan Hi Igor, I send you the low level driver. Up to now it was allways helpfull. By the way DAvE generates wrong routines. Stefan
Dear Mr.Stefan, I have the same problem as here discussed.I use XC161 controller to communicate with EEPROM with IIC.The writing routine runs well and reading routine doesn't.May I share you read routine too?That is for me very helpful. Thank you very much! zhen pei
Dear Zhen Pei, this is the low level routine from Infineon, but no problem to send it to you. Please leave your e-mail address here. I will send it to you. Stefan
Hello Stefan, I am working with the I2C module of the XC161. Could it be possible to publish the low level routines somewhere on the WEB ? Thanks for your help David