Zubax babel schematic and hardware init for libcanard


(Kent Martin) #1

Hi,
I am trying to run libcanard on the zubax babel board.
I couldn’t find a schematic anywhere to show what the crystal is and pin connections to the stm32.
I am trying to use cubemx to set up a project so I need to know what the xtal frequency is and pins connceted. I also need to know what the HSE_VALUE define refers to? Is it External crystal frequency or is it the system clock, or pll clk frequency?

Thanks.


(Alexander Sysoev) #2

Greetings! Please find babel schemaitc attached to this post
babel.pdf (58.2 KB)
HSE_VALUE is indeed frequency of the external crystal. System clock is obtained from it using PLL with its prescalers and dividers. UAVCAN may work with different system clock settings, it just has to know these settings. For that there is a function canardSTM32ComputeCANTimings.


(Kent Martin) #3

Hi,
Thanks, I did manage to create a startup project and got it to build and run, but it did not work. It got stuck in a tx function somewhere.
Is there any chance i can get the original .ioc (cubemx ) file used to generate the project?
I’m using SW4STM(ac6) not ewarm that appears was used in the sample code.
There is something wrong. Most code should be the same but the startup (.s) file is not.
I couldn’t see one there that was for sw4stm that would build on it, so I need to generate from cubemx.
Having the original cubemx file would help greatly in narrowing down what the problem is.
It might help to see where there are differences in generated source.

Thanks.


(Alexander Sysoev) #4

I’m sorry but there is no *.ioc file for this project as iCubeMX was not used to generate any code here.
Stm32CubeMX is well known for the low quality code it generates so I try to avoid it if I can.
If you’d like to use any kind of library for hardware init, I’d recommend you go on with SPL.
Also, do you have step by step debug available? It would be useful to know on what step exactly everything stops.
Best regards, Alex


(Kent Martin) #5

Hi,
I’m back on this again after a break.
I created another project in ac6 with SPL drivers, then copied over the drivers from the zubax source, and left cmsis from the created project. The startup file calls SystemInit from “system_stm32f37x.c” supplied in the source. hwInit is called from the supplied main.h, then swInit. The can timings computed are bit_rate_prescalar = 2, bit_segment_1 = 7, bit_segment_2=1,max_rescynchronization_width=1.
It does not transmit or recive anyhting.
When attempting to transmit it gets stuck in sendCanard() while (txf) loop.
canardSTM32Transmit() always returns 0 , meaning it didn;t transmit anything and keep it stuck in the while loop.
For first call we get result 1, then after always 0 for canardSTM32Transmit
Inside the function tme[3] = false,true,true
isFramePriorityHigher returns 0 and then the function exits wuth return code 0.
There is a mailbox whose priority is higher or equal priority of the new frame.
This is always returned.
I have a zubax babel connected to the other end running uavcangui which of course doesn’t show any messages incoming. I have checked the termination resistor is on for the uavcan gui babel device.
Is there anymore info on how to get this project to run?
Any clues or more debug required to find the problem?

Thanks,
Kent


(Kent Martin) #6

Hi ,
I’m still at a loss to get this going after a lof of effort.
Can anyone help to get this project running?
I thought this should be relatively easy, but it just won’t work.
Is there any other things to try or test to find the problem?
The only thing I am doing differently is using SW4STM.
I am not sure what else I can try to get this to work.
I tried disabling sendCanard, so it doesn’t get stuck in a loop, but still nothing is recieved.
Please Help!!


(Alexander Sysoev) #7

Hi Kent Martin! Sorry for the delay.
Let me try to help you. Can you please describe your setup a bit more detailed? How many UAVCAN devices do you have on the bus and what are these devices? Could you also share your source code? I may want to reproduce your issues precisely.
Best regards, Alex


(Kent Martin) #8

Hi, Thanks you can see the source here for 2 projects I did on the babel.
https://www.dropbox.com/sh/cv3f0c1fcaa2cfs/AAD5D8W_gq6uDVFVEmXrvXkja?dl=0
I have 2 zubax babels connected to each other. One with uavcangui running at 1Mbps , the other running the code in the link.
Thanks,
Kent


(Kent Martin) #9

BTW,
I now have made a standard CAN setup using cubemx and I can see messages coming out.
It’s not uavcan but I can at least get the hardware to do something. Although after the 1st transmit it fails as no one is responding to it I presume, and you have to stop it and restart it before sending another packet. I’ll try put libcanard on top of this and see if it can work then.

Kent