cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F405 with LSI LS7266r1 / ''8 bit bidirectional parallel bus'' on STM32f4

aadityadengle
Associate II
Posted on December 19, 2014 at 17:25

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-bus
8 REPLIES 8
Posted on December 19, 2014 at 18:02

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.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on December 19, 2014 at 18:04

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

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
aadityadengle
Associate II
Posted on December 19, 2014 at 18:14

''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.

aadityadengle
Associate II
Posted on December 19, 2014 at 18:15

Yes you are correct. 

Posted on December 19, 2014 at 20:36

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.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
aadityadengle
Associate II
Posted on December 20, 2014 at 03:48

aadityadengle
Associate II
aadityadengle
Associate II
Posted on January 25, 2015 at 14:26

Please check

https://github.com/aadityadengle/STM32F4__LS7266r1_Library.git

 to download working solution.