2014-12-19 08:25 AM
Hello,
Its very new for me to work with any 32 bit MCU like STM32F405, I am having a handful experiance with AVR but not with ARM. Here goes the situation where I have stucked.....I have to compute linear encoder count and use it in CNC project. so far I could able to find that asking MCU to count the encoder is sheer waste of MCU resources and it makes all rest of the code dicy. There are lot of chances where we can miss the pulses. In any CNC (let it by any one for any purpose) loosing pulses are just not accepted, accuracy is everything. So to deal with the situation I decided to go with specialised hardware (Quadrature Counter IC / Quadrature Decoder) made by LSI CSI, . This was decided while I was working with Atmega2560, now as the project is getting more and more complicated I have diverted the project to ARM STM32F405. the MCU is very ok for me (atleast for now) and its all other stuffs are going well except I cant able to drive LS7266r1 properly. As per datasheet LS7266 has 8 bit Tristate parallel bus to do data transaction with MCU. being a data bus it is bidirectional in nature. To communicate with the IC I need to have a ''8 bit bidirectional parallel bus'' on GPIOC (other have been used for different purposes and only one have been left) I am using Bhasha Technology make board, which has very limited documentation. Till now I have able to assemble a library (which is not with me right now but can post here by tomorrow) containing all necessary functionality for LS7266r1. Please help me to sort out ''8 bit bidirectional parallel bus'' over STM32F405. I cant find any way to put GPIO in bidirectional mode. Is it possible to do so? If so please guide me. If not please let me know the alternatives.Thanks in advance. #8-bit-bidirectional-parallel-bus2014-12-19 09:02 AM
Well the STM32 timers can be configured in Encoder mode to count up/down signals, you don't have to interrupt at every count, and could set check/limit points, or sample periodically (1Hz, 100Hz, whatever).
You'd have to reconfigure the GPIO pins in INPUT or OUTPUT mode to get the directionality you want at specific times. You could also presumably use open-collection mode, pulling the pins high, set high when not in uses, and just drive low to output zero bits.2014-12-19 09:04 AM
This board? (proper link, not just underlined text)
http://www.bhashatech.com/attachment.php?id_attachment=30
http://www.amazon.in/Bhasha-Technologies-TIGERM3-Cortex-Tiger/dp/B00NNQ3CD0
2014-12-19 09:14 AM
''You'd have to reconfigure the GPIO pins in INPUT or OUTPUT mode to get the directionality you want at specific times.''
So you are asking me to toggle the GPIO mode every time when the data direction changes. I think this will make all the system slow again. I have to read the encoder values quite frequently and update the variable with same. The variables are again controlling entire cnc operation. so I dont want to take any risk with them.'' Well the STM32 timers can be configured in Encoder mode to count up/down signals, you don't have to interrupt at every count, and could set check/limit points, or sample periodically (1Hz, 100Hz, whatever). ''Yes, I have checked that approach too. but no success with the my setup. I am missing lot of counts and also I did not able tackle with the bounces. perhaps you can help me to have a look over that again.2014-12-19 09:15 AM
2014-12-19 11:36 AM
Yeah, I don't know what slow is in your book, but suitably coded you can get signals in/out GPIO pins in the ten's of MHz.
If you want a micro-processor bus type interface, consider the FSMC, 16-bit wide data bus, 20+ bit wide address bus, multiple chip select regions.2014-12-19 06:48 PM
2014-12-21 08:24 AM
Here are my Libs for LS7266r1.
@Clive, will you please check? also if possible please share your code for reading quad encoder with timer. ________________ Attachments : cortex7266.c : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HznY&d=%2Fa%2F0X0000000bPn%2FwuFSYR6msrtKxpLouA_qqPPMGIplN3vs68lL6ehrTPA&asPdf=falseCortex7266.h : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HznO&d=%2Fa%2F0X0000000bPo%2FY96TQSRINBalg2O7QP1COwldOPGF8KmeyQuqxtNPpYc&asPdf=false2015-01-25 05:26 AM
Please check
https://github.com/aadityadengle/STM32F4__LS7266r1_Library.git
to download working solution.