Page 1 of 2

can post project if needed

Posted: Sat Oct 06, 2012 2:21 pm
by alex31
I have done an interface board for pedagogic purpose for curses about PLC

the project i have done is an interface card based on olimex p407 wich permit the plc to pilot
a lynx robotic arm http://www.lynxmotion.com/c-124-al5a.aspx from
a modicon PLC

on output i have 5 pwm
on input i can choose between 5 modes :

* console based ui over serial usb, i use a slightly modified version of microrl
* PLC : logical level (5 for action, 5 for direction)
* PLC : analog level (5 for absolute position)
* PLC : modbus over serial, RTU or ascii (using freemodbus library)
* PLC : modbus over tco, RTU or ascii (using freemodbus library and lwip)

I store permanent state in flash using the last 128ko of eeprom with a mechanism to
reduce wear.

debug message and log are printed on the lcd 6610 screen, in bit banging mode, (this screen use 9 bit spi) in the future, i will
use a olimex E407 instead of P407, so i will connect the screen to an usart configured in synchronous 9 bit mode to use it as spi and
avoid bit banging.

i use chibios hal for all peripheral access,
i use fpu, ccm ram as heap for malloc/free, rtc (saved by battery), gpt, adc, uart, serial over usb, pwm, time
compile with the linaro gcc recommanded toolchain

in fact, nothing new, i have used example form chibios as inspiration, and a lot of open source code found on the net, but it's a working project, so if
someone things it can help, i will put the tar.gz somewhere.

thanks again to the chibios team to give us a so well designed piece of code :-)

Alexandre

Re: can post project if needed

Posted: Sun Oct 07, 2012 11:45 am
by Giovanni
Very interesting, sure go ahead and post code, more examples would not hurt for sure.

If you want I can move the thread in the User Projects forum.

Giovanni

Re: can post project if needed

Posted: Sun Oct 07, 2012 9:50 pm
by alex31
Very interesting, sure go ahead and post code, more examples would not hurt for sure.

If you want I can move the thread in the User Projects forum


Well, when it will be finished, on final hardware, documented, it could be put in User Projects forum,
for now, let's consider that it is a collection of sample.

there is only Makefile for forum recommended linaro gcc 4.6.2, i have not tested that
it compiles under windows since i am a pre-windows old unix guy.



https://docs.google.com/open?id=0B3a7E0ODHTNHQkdzSi1fQjJnVEU

Alexandre

Re: can post project if needed

Posted: Thu Apr 04, 2013 6:06 am
by DeusExMachina
Very interesting project for me! Do you finished it?

Re: can post project if needed

Posted: Thu Apr 04, 2013 4:26 pm
by alex31
Very interesting project for me! Do you finished it?


it has evolved, now it runs over an olimex e407 instead of p407, i am using 4dsystem oled screen instead of nokia 6610,
the robotic arm has been modified so i will have access to the real servo position to make position control,
and current consumption can be monitored to protect servo motor, but i am waiting for
a team which design the interface card with the Programmable Logic Controller, and interface card with the robotic arm to test and to write the code for servo control.

jbus/rtu and bus/ascii ober rs485 has been tested ok with an old april 5000 plc, jbus/ip hab been tested ok using modpoll on a pc.

i can send you the last tarball if you want, and system should be finished by this summer.

Alexandre

Re: can post project if needed

Posted: Sat Jul 12, 2014 4:03 pm
by chrismerck
Hi Alexandre,

Great work! I'm also working on a ChibiOS FreeModbus slave project.

One question: Why did you not use "chSysLock" and "chSysUnlock" in vMVPortEnter/ExitCritical() ? Instead you seem to have bypassed the locking.

Best,
Chris

Re: can post project if needed

Posted: Sat Jan 24, 2015 1:04 pm
by alex31
I have miss this post, sorry.

To answer the question, the problem is that in freemodbus code, ENTER_CRITICAL_SECTION can be
call within a critical section, and that to be fine, a counting semaphore would be necessary to

1/ not call chSysLock twice (or more)
2/ exit lock zone at the last EXIT_CRITICAL_SECTION

it seems that none of the work done inside freemodbus CRITICAL_SECTION really involve that is should be done
inside a chibios syslock zone since i have never had hangs.

for now, this project is again in standby because of shortage on a component we have chosen for 24volts plc logic
(i2c half bridge), when we will have receive components, solder the last (v3) pcb, and gives curses on plc with students to
track last bugs, i move the code and gerber files from internal git server to github.

Alexandre

Re: can post project if needed

Posted: Wed Jan 28, 2015 3:17 am
by Chudik
modbus over serial, RTU or ascii (using freemodbus library)


Very interesting!!!
Does it have both master and slave parts?

Re: can post project if needed

Posted: Wed Jan 28, 2015 10:18 am
by alex31
No, there is only slave part. The PLC is the master, the stm32+chibios stuff is the slave.

Alexandre

Re: can post project if needed

Posted: Fri Jan 30, 2015 6:31 am
by Chudik
Hmm, my current project is slave and master simultaneously, but at least I can use the slave part first. So, thanks anyway :)

Are there plans to make master part?

Igor