Hello,
I just would to remember to implement in the next release, if possible, the addition of a NOP asm instruction after every TRIS change to the I/O ports, as requested/recommended on the Microchip datasheet.
I just sent an email to M.E. crew about this some month ago after 4.0.0.0 release, and I would only to submit a reminder.
I am not sure if it is correct from a logic point of view to do this at compiler level, but if not, I think that this NOP instruction could fit in the user manual somewhere, in order the developers could remember to add it to the code.
Thank you.
picdog
asm NOP after TRIS change
asm NOP after TRIS change
... a proud user of MikroElektronica EasyPic3, EasyPic4, BigPic4, MikroC for PIC, EasydsPIC2, dsPIC-Pro2, LV24-33 and MikroC for dsPIC :)
Re: asm NOP after TRIS change
Thanks for the tip, we will surely do something about it.
Hello Milan,
I found the information on paragraph 10.4 of the Microchip documentation for dsPIC33 families (but I remember also on PIC24F/H). The reference is document DS70286A.
I am not at the office at this moment but I can copy/paste this reference for you.
dsPIC33FJXXXGPX06/X08/X10
Data Sheet
Chapter 10: I/O Ports.
Sub-Chapter 10.4
10.4 I/O Port Write/Read Timing
One instruction cycle is required between a port direction change or port write operation and a read operation of the same port. Typically, this instruction would be a NOP.
Hope this helps. At the moment I am adding the NOP instruction manually where required.
Best regards,
picdog
I found the information on paragraph 10.4 of the Microchip documentation for dsPIC33 families (but I remember also on PIC24F/H). The reference is document DS70286A.
I am not at the office at this moment but I can copy/paste this reference for you.
dsPIC33FJXXXGPX06/X08/X10
Data Sheet
Chapter 10: I/O Ports.
Sub-Chapter 10.4
10.4 I/O Port Write/Read Timing
One instruction cycle is required between a port direction change or port write operation and a read operation of the same port. Typically, this instruction would be a NOP.
Hope this helps. At the moment I am adding the NOP instruction manually where required.
Best regards,
picdog
... a proud user of MikroElektronica EasyPic3, EasyPic4, BigPic4, MikroC for PIC, EasydsPIC2, dsPIC-Pro2, LV24-33 and MikroC for dsPIC :)
Hi,
I searched in PIC16 and PIC18 families
As you explained I found this note in family datasheets for dsPIC33 and PIC24H:
10.4 I/O Port Write/Read Timing
One instruction cycle is required between a port
direction change or port write operation and a read
operation of the same port. Typically, this instruction
would be a NOP.
I also found it in PIC24FJ datasheets, in chapter 9.2.1
We can't add NOP automatically, user can modify TRIS registers in several
different ways, compiler is not aware of TRIS change in all cases.
We intend to gather information about required nop and put it on forum as a tip for users.
I searched in PIC16 and PIC18 families
As you explained I found this note in family datasheets for dsPIC33 and PIC24H:
10.4 I/O Port Write/Read Timing
One instruction cycle is required between a port
direction change or port write operation and a read
operation of the same port. Typically, this instruction
would be a NOP.
I also found it in PIC24FJ datasheets, in chapter 9.2.1
We can't add NOP automatically, user can modify TRIS registers in several
different ways, compiler is not aware of TRIS change in all cases.
We intend to gather information about required nop and put it on forum as a tip for users.
Hello Milan,
I'm glad my post was useful for you.
I agree with you, this NOP is not possible to be managed at compiler level, in fact in my first post of this topic I wrote that "... I think that this NOP instruction could fit in the user manual somewhere, in order the developers could remember to add it to the code".
Great idea to add it as a tip on the forum.
Best regards,
picdog
I'm glad my post was useful for you.
I agree with you, this NOP is not possible to be managed at compiler level, in fact in my first post of this topic I wrote that "... I think that this NOP instruction could fit in the user manual somewhere, in order the developers could remember to add it to the code".
Great idea to add it as a tip on the forum.
Best regards,
picdog
... a proud user of MikroElektronica EasyPic3, EasyPic4, BigPic4, MikroC for PIC, EasydsPIC2, dsPIC-Pro2, LV24-33 and MikroC for dsPIC :)
Hi picdog,
we published it here
http://www.mikroe.com/forum/viewtopic.php?t=14545
Thank you once again.
we published it here
http://www.mikroe.com/forum/viewtopic.php?t=14545
Thank you once again.