Hello Everybody,
I have some original Trampa VESCs here trying to achieve the Following setup:
1 ext. controller sends UART Commands to VESC 1 which is connected to VESC 2 through CAN. The UART commands also include control and monitoring for VESC 2. There are however some additional Hardware items (lights) connected to VESC 2 (Vesc 1 pins are taken by communication with battery etc.) that also need to be turned on and off. I want to use LISPBM for this purpose. I am able to control the lights from the REPL but fail to establish a communication between VESC1 and 2 using LISP.
I tried SID as well as EID frames. However I cannot get CAN events to trigger. I also tried very basic code setups like the following basically a c-p from the LispBM docs :
Sender: (loopwhile t (progn (can-send-sid 75 (list 0xAA 0x11 0x15)) (print "sent CAN SID ") (sleep 1.0) ))
Receiver:
(define proc-sid (lambda (id data) (print (list id data)) ; Print the ID and data )) (define proc-data (lambda (data) (progn (print data) ))) (define event-handler (lambda () (progn (recv ((event-can-sid (? id) . (? data)) (proc-sid id data)) (recv ((event-data-rx ? data) (proc-data data)) (_ nil)) ; Ignore other events (event-handler) ; Call self again to make this a loop )))) ; Spawn the event handler thread and pass the ID it returns to C (event-register-handler (spawn event-handler)) ; Enable the CAN event for standard ID (SID) frames (event-enable 'event-can-sid) ; Enable the custom app data event (event-enable 'event-data-rx) (loopwhile t (progn (print "running ") (sleep 1.0) )) I am running FW6.00 beta on both controllers. I was able to see the messages in the can analyzer when using CAN_MODE COMM_FORWARD on both controllers, but thought this is supposed to work with CAN_MODE VESC ? Also the Events did not work in COMM_FORWARD either.
Is there something I am missing ? some flag I need to set etc ? I did not compile the FW myselb but used the FW supplied with the VESC Tool V4 Test Version 5.
I would appreciate any clues to what's wrong with this code.
Sorry for the formatting - code highlighting is not available for lisp here so I just c-p'ed from VESC Tool.
Thanks in advance !
Regards
Max
Hello Again,
I am sorry for spamming the forum - I actually had tried for a few hours before posting here - now I just downloaded the current VESC_TOOL (4.00 test version 7) uploaded the new fw - got the code up and voilá - it works. beware my test code did not quite work as there was no app supplying data in the code i share here so the receiver needs to look like this in order not to indefinately wait for data :
Leaving this up for anyone with similar problems.
Regards
Max