Servers by jDrones

CANbus for Ardupilot with UAVCAN and UC4H


(mike kelly) #21

No not at all. No problem Martin!


(ppoirier) #22

Ok I’m jumping
So I got a bluepill setup as a UC4H SLCAN Adapter.
I downloaded the UAVCAN GUI TOOL
I have updated the CP2101 speed
But I am a little bit puzzeld to what firmware I should upload on the bluepill to get the sniffer working… lookin at github https://github.com/olliw42/uavcan4hobbyists I see different releases and type of bootloader and I cannot find any information on which one to use …

@mike wich one to upload to get the UC4H SLCAN Adapter started ?


(Luís Vale Gonçalves) #23

I believe our friend @olliw42 will be ready to help :slight_smile: as always :wink:


(OlliW42) #24

uc4h-slcan-v009.hex or uc4h-slcan-v009.bin
per STLink on the SWD pins (or FlashLoader on UART1 with the BOOT pin grounded)
the SLCAN adapter has no special bootloader for upgrading, this one is doing really rarely
you always take firmware from folders not called ‘old’ or ‘upto’ or such, or that with the highest v number if you like to search


(ppoirier) #25

OK thanks @olliw42 , I uploaded uc4h-slcan-v009.hex using the CP2101 and setting jumper boot0 to ground.


(ppoirier) #26

Hello,

Making progress, incidentally I got stuck with defective converter and marginal CP2101 that could not get up to speed… @luisvale , yep good old AliExpress got me again with half of my parts defective… So for everyone interested experimenting, getting the JDRONE prebuild and working units may be a better alternative :wink:

@olliw42 I got 2 units working OK as SLSCAN so I can see the PixHawk on the GUI.
Now, I want to modify on of the unit as a Magnetometer Node, I tried to flash the boot loader but I cannot see the node with the slscan, I tried flashing the uc4h-gpsmagbaro-v026.hex , but no success, Am I missing something here ?

Here is my setup ( as you can see , I replace the CP2101 with FTDI units)


(OlliW42) #27

yeah, the quality of the bluepills is at best varying, and I also had much initial troubles with the transceivers

bootloader: my first guess would be that you have not activated the dynamic node allocation server, it’s this rocket button in the right bottom of the gui, also the local node thing needs to be activated, it’s this check button in the left top
EDIT: I actually have a short video of this LOL: https://www.youtube.com/watch?v=CeYhnRaxl18

uc4h-gpsmagbaro-v026.hex: from scratch I wouldn’t know what could go wrong. I haven’t done that for a long while with a bluepill, so I just have flashed my bluepill with it (STLink) and it right away showed up, as Node 44. It shows an ERROR since there is nothing attached, but that’s how it’s supposed to be.

One thing I want to emphasize: Take care of proper powering, if you power your bluepill(s) from the USB-TTL adapter this can be way too weak and cause all sorts of “funny” (= unpredictable) behavior. If you ask me for the No.1 trap than it’s the powering.

I see you have a mag on one board. Currently the firmware only supports a HMC5883L type (I need to get me some others LOL). I’m, not sure if my sketches on the web page are really up to date, I just checked the code and it should be on I2C1 = SCL,SDA: PB6, PB7.


(ppoirier) #28

Well, did all the above (even reflashed with STLink ) an no node… Pretty certain I am dealing with shitty converters, I have ordered other units from a more reliable source, but at the end of the day , I will end up ordering JDRONE units , as the DIY is OK for bench testing but totaly impractical in a vehicle.
Yes the mag is the HMC5883L and it is connected correctly.

Thanks for you help, and keep on the good work.


(OlliW42) #29

did you try to power the bluepill on it’s 5V pin with an extra 5V source?
you are not trying to use the 3.3V out of the FTDI adapter, right?
on the transceiver modules there are two resistors, I had some there they had been swapped, maybe you want to check with a magnifier glas


(ppoirier) #30

Yep , sorry I forgot to mention, I also double check for the 120 ohm terminator resistor on buth converters was ok.


(OlliW42) #31

What would happen if you would flash the other one with the gpsmagbaro code, same?
What would happen if you would use e.g. the esc firmware, same?
What would happen if you in addition would add the pixhawk to the CAN bus network, i.e. have all three on it (and the pixhawk powered)

given that they both each worked as SLCAN adapter, it’s somewhat unsatisfying


(ppoirier) #32

Ok I will proceed ang get back a little bit later… getting outside skiing :skier:

Regards


(OlliW42) #33

getting outside skiing :skier:

lucky you … snow is really bad this year in our area … have fun


(ppoirier) #34

@olliw42

Thanks for your insistence , I use a MCP2562 from my BBBMINI to replace the defective (2 out of 3) converter.

Now I am trying to get rid of the error, I know that I have to bits mask to 2 (0b010) in order to get only the Magnetometer, I think I did it ok but still get the error and cannot see or plot the Mag Data:

Is my logic correct ?

Regards


(OlliW42) #35

great!
Maybe I should emphasize the potential issues with the cheap transceivers on the webpage.

some parameters are effective immediate, some other parameters need to be Written and Stored (=make them permanent), and the node to be Restarted. Some parameters are evaluated only at startup, these are especially those which determine what functions are effective.

The NodeConfiguration parameter is of the latter kind. You got the logic: It’s a bit mask, 1 is for GPS, 2 for the mag, and 4 for the baro. So, 2 should set it into mag-only mode. However, the name should then also change to uc4h-mag. I still see the name uc4h-gpsmagbaro, which tells me that the NodeConfiguration parameter isn’t effective. I guess after a Restart and FetchAll you’ll see it going back to 0. The good thing, you don’t really need it. For the moment I suggest to leave it a 0, which is maybe more educational.

Functions are enabled/disabled by various means (this is what makes these multi-purpose nodes a bit user-unfriendly). Here, to disable the gps and baro, you set GpsRate = 0 and BaroRate = 0, ideally you also would set UartChannelId = -1 to disable also this. Don’t forget to Store and Restart. NodeConfiguration = 2 would have the same effect (but in addition would change the name, and e.g. the Debug output).

Next you should set Debug = 1. This produces printouts in the right top corner, which repeat every 20 secs (if you have started it by pressing the camera-looking button there, which I think it is by default however). With NodeConfiguration = 0 you should see info like “tnl1 initialized”/“tnl1 not initialized”, “gps initialized”/“gps not initialized”, etc. you get the pattern. So, for the mag, you should see “mag hmc5883l inited”, if you see “mag not initialized” then we know the problem.

If it’s the setup in the photo, I think you’ll see “mag not initialized” for obvious reasons, it would be the time now to add the mag.

btw, you could add a LED to PA4 if you wanted to, it would probably currently blink fast.


(ppoirier) #36

Hello,
Yes, you either go DIY and spends endless hours testing, debugging, swaping bad or marginal components , or buy tested and ready to use modules from jDrones . Finally I am the one doing the sale pitch, and all of the above might be considered as a proof :slight_smile: !!

Anyway , being a hardcorer DIYer, I will make it work .
2 things

  • The magnetometer is the fake HMC5883L (GY-273) = they are actually QMC5883 modules , so I guess they are not compatible with your code ? (As you might know, Honeywell decided to abandon HMC5883L). Here is the arduino lib: https://github.com/mechasolution/Mecha_QMC5883L

Edit: Meanwhile I will test with the ‘‘real thing’’ using a GPS M8N.

  • I understand the method for disabling, but I am curious about the permanent masking, could you point me on the method to make the mask permanent so it after a Restart and FetchAll its not going back to 0 ?

Best Regards


(OlliW42) #37

you need to press the StoreAll button, this “transfers” the parameter values into permanent memory. Canonically, you do a FetchAll, check all values, and then a StoreAll. The UAVCAN GUI unfortunately doesn’t clear the parameter list e.g. after a Restart, which can be quite confusing sometimes. So it’s a good idea to do the FetchAll before a StoreAll.

yes, I do know that the HMC is EOF. There just didn’t had been any need so far to add another. I knew about the QMC, but wasn’t aware that it might not be compatible. Many thx for that hint.
I’ll check what might have to be changed. If you wouldn’t mind, I would appreciate if you could test the improved firmware.

GPS: I was afraid of this … so let me tell this: I DO NOT RECOMMEND USING THE GPS. I RECOMMEND USING THE TUNNEL INSTEAD. I stopped developing the GPS feature once I saw the tunnel messages looming, It’s development stopped more than a year ago. As regards reasons, I don’t want to bother with all details, but just resort to mentioning that as response to several posts on issues with the Zubaxx GNSS and AtrduPilot, ArduPilot was taken off the Zubaxx pages as recommended flightcontroller… The GNS feature can be made to work, but I can tell you it’s not going to be convenient and trouble-free. Use the tunnel feature instead.


(ppoirier) #38

Cool,
I am standing by for any test you’d like.
As for the tunnel , its not problem, actually I think that concept could be extended to other interfaces as well , like I2C Analog and SPI. That way, UAVCAN remains to the transport layer as it just expose different interfaces and do not mess with drivers.


(OlliW42) #39

I am standing by for any test you’d like.

great, THX

As for the tunnel , … , actually I think that concept could be extended to other interfaces as well , like I2C Analog and SPI. That way, UAVCAN remains to the transport layer as it just expose different interfaces and do not mess with drivers.

well, for I2C I concluded that I don’t think it’s a good concept, I think that especially for the typical I2C devices the UAVCAN concept would show it’s strength. But that’s OT discussion and this thread probably shouldn’t be polluted with it.
I just wanted to bring across that if you want to use the UAVCAN/UC4H GPS you can do it, it’s working, but it needs some braveness too. With the tunnel it’s just all super easy and also works much better.

started checking out the QMC differences … :slight_smile:


(Khancyr) #40

Hello,
I think it would be more conveniant to have a dedicated section about uavcan and UC4H. That will prevent some valuable information to be bury in this thread.