-
Notifications
You must be signed in to change notification settings - Fork 13.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PR Matek M9NF4 GPS Uavcannode Initial Board Support #18621
Conversation
Would |
I changed to matek_gnss-m9n-f4. Having issues with the canbootloader startup, I am not seeing anything on the zubax babel. So no node ID allocation occurs. |
How’s this going @dirksavage88 ? |
Not great. I'm getting a memory management fault, unexpected isr. Also a debugassert in boot.c, something having to do with the uavcan board identity. I changed the name in the uavcan board identity file to ""org.matek.gnss-m9n-f4"" but this issue persists. See attached output from STM32CubeProgrammer. I have not found a way to get a debug probe on this board, so I've just been using STM32CubeProgrammer and reading the memory. |
Hmm. Maybe @davids5 has an idea about this? Will take a look as well. |
I would solder the wires on the F4 for SWD/SWCLK and debug it with Jtag. |
thanks @davids5 for chiming in - @dirksavage88 there are swd/swc pads on the top routed to pa13 and 14 (they are sort of hidden when the plastic grommet is in place). See the attached pic. that should let you debug pretty quick: |
@dirksavage88 breakpoints in timer.c although @davids5 would be the definitive word on this. |
Set a breakpoint on |
I have gotten past the hardfault, I’ll commit my changes and compare the builds (changed board.h to match what is in the ardupilot hw_def). But the bad news is that I am once again stuck on reading the master status register within the ‘can_autobaud’ function. This is the second ardupilot can node board ported over that is not reading the MSR and receiving samples during the canbootloader bit rate detect. Either I’m doing something wrong or these boards aren’t a direct port for the canbootloader to function out of the box (without changing the bootloader stm32 minimal driver code)? |
Please check the pinout and pin mapping. |
@dirksavage88 went to take a look at your pin mapping but saw that it hasn't been updated (or the version in your branch is incomplete). I'll take a look at is as well after you do the pr (assuming you dont have it working). |
Still not working, and still having hardfault issues. |
Take a look at #18402 It's the same series f4. Additionally, I'd get the pinout and pin mapping sorted first. |
What are you using for an FMU to test with? The board docs say
So that the pin mapping in board.h looks OK and I checked the nuttx mapping for #define GPIO_CAN1_RX_2 (GPIO_ALT|GPIO_AF9|GPIO_SPEED_50MHz|GPIO_PUSHPULL|GPIO_PORTB|GPIO_PIN8) You can verify this with an ohm meter. CAN_{RX|TX} to the transceiver and the then the H and L. Check for H to H and L to L on this board to FMU. Also I am assuming you have the CAN of the device connected to CAN1 on the FMU and uavcan is stated with |
@davids5 Im using a zubax Babel to talk to the can node along with uavcan gui tool to set dynamic node id. Right now I get nothing coming from the CAN bus (no node status or anything) but I will try with a dmm to check the transceiver. I can switch CAN connectors on the Babel but it should pick up the node on both. At least it has done this for another node I am working with. |
Is this still hard faulting? |
Yes, but i've narrowed it down to an app descriptor signature that is not lining up with application load address? In retrospect I probably should have made this a draft PR. I did get some of SPI, I2C settings to line up with the board mapping, but still having issues with the canbootloader application itself. |
So as of now, I have a working canbootloader that gets a node ID from the allocation server, and the firmware can be updated. However, the app falls through somewhere. Is this something I can debug in eclipse? I assume the hand off to the application is working correctly, but something in my boardconfig/nuttx config on the application side is incorrect leading the image to fall through. |
@dagar is there anything you can see that sticks out on the boardconfig for the f405? |
@dirksavage88 - there is a merge commit that has messed this up. Please rebase on master and force push. Then make sure that the Apps' script.ld has this https://github.com/PX4/PX4-Autopilot/blob/master/boards/ark/can-rtk-gps/nuttx-config/scripts/script.ld#L73-L83 break in jump_to_app. in eclipse' debug console you can use:
to then set breakpoints in the application. Also ensure the watch dog is off until you get it stable. There should be code to disable the WD while in the debugger, but it might not be working on the F407. |
Signed-off-by: dirksavage88 <dirksavage88@gmail.com> Added uavcan board identity Signed-off-by: dirksavage88 <dirksavage88@gmail.com> Added usb.c, LED rework may be needed Signed-off-by: dirksavage88 <dirksavage88@gmail.com> PX4 dates added to all files Signed-off-by: dirksavage88 <dirksavage88@gmail.com> Matek M9NF4 CAN Node initial board support Signed-off-by: dirksavage88 <dirksavage88@gmail.com> Changed GPS to ttyS3 in board sensors, led board on/off definitions Signed-off-by: dirksavage88 <dirksavage88@gmail.com> Added app descriptor section to canbootloader linker script Signed-off-by: dirksavage88 <dirksavage88@gmail.com> Changed board naming convention to match vendor Signed-off-by: dirksavage88 <dirksavage88@gmail.com> Changed canbootloader and nsh menuconfig Signed-off-by: dirksavage88 <dirksavage88@gmail.com>
Signed-off-by: dirksavage88 <dirksavage88@gmail.com>
40943d2
to
fcf5862
Compare
I rebased to master to get rid of the massive diff. App is now working. Still have to verify GPS + IMU config in PX4, but I see magnetometer and baro messages on the bus so far. |
…S & IMU config Signed-off-by: dirksavage88 <dirksavage88@gmail.com>
How are you currently uploading the firmware? I happen to have one (matek module) with me but no jtag (I'm out of town). Is USB upload working? I can give the PR a try as well. |
@ryanjAA I set the canbootloader + param storage to 64kb to match what the ardupilot bootloader is set to. However, I am not sure if flashing the px4 app firmware on top of the ardupilot canbootloader is preferable, I think the PX4 one does not brick whereas ardupilot can fail, but I can't verify if this is the case. I flashed the PX4 canbootloader first using the arm debug pins (and JLinkGDBServer + arm-none-eabi-gdb), but I will try test stm32 cubeprogrammer as that is more user friendly (and uses USB). After the px4 canbootloader was working, I used uavcan_gui_tool to update firmware, I have not tried to update over the FC yet. |
@davids5 I think I'm ready for a review on this PR. I was fighting with the IMU to get working but there isn't much in the Matek Sys docs to go from. Then there is the issue of calibration of the IMU...which may or may not be worth the hassle. @ryanjAA if you need the IMU, I can continue to shoot now that I have the dev console working on the node, if not, I think this can be finalized. The GPS, mag, and baro seem to be working. |
Pretty cool. I think support without the Imu is fine unless @dagar thinks it should be there for completeness. Did you happen to test if the bootloader can be uploaded via usb? I’m also thinking about a generic user buying one of these and wanting to use it as a node and their setup workflow. |
@ryanjAA I have not tested flashing the bootloader via usb, but it should be doable using stm32cubeprogrammer and flashing the *.bin file after holding down the dfu button and connecting via usb. |
I'll give this another review. |
@dirksavage88 i tried via USB but I wasn’t able to get it to work although i just grabbed the artifacts from the PR. I don’t have access to a jtag until next week but would be good to see if someone else can get this to work via usb. |
I was able to flash the canbootloader over USB with STM32CubeProgrammer. |
Just to confirm, I downloaded the artifact from: https://github.com/PX4/PX4-Autopilot/actions/runs/1661161132 rather then compiling. Which is px4_package_matek_gnss-m9n-f4: https://github.com/PX4/PX4-Autopilot/suites/4846264281/artifacts/137910222 then put it in dfu and uploaded the matek_gnss-m9n-f4_canbootloader.bin file via stm32cube but after putting the firmware on from the same artifact I see no can node when hooked up to a pixhawk 4 (hardware is fine checked it ap_prehiph). I’ll take another more in-depth look but I’m missing something I think. |
There should be a firmware file xxx-x.x.xxxxxxxx.uavcan.bin, this is what is supposed to go on the flight controller SD card: https://docs.px4.io/master/en/uavcan/node_firmware.html I believe uavcan has to be set to 'sensors automatic config' on the FC parameters. EDIT: I can help troubleshoot much better on the discord: https://discord.com/invite/AWrd2XYrjj |
Ohhh I was flashing all via stm32programmer. You’re doing it the easier (and correct) way which I stupidly didn’t try. Ya, so bootloader is most definitely in. I’ll redo this tomorrow. On master now you have to subscribe to each sensor but all works with other nodes. Will confirm after testing. 👍 Noted on discord. Will connect there. |
Uploads fine... Running dmesg after looks like mag isn't showing up and baro temp?: ERROR [uavcan] GetSet error during param count and uavcan status: Sensor 'baro': Sensor 'gnss': Sensor 'mag': Online nodes (Node ID, Health, Mode): listener sensor_baro: |
@davids5 could there be an issue with something on nuttx here? I’ve been speaking with @dirksavage88 and the pr works for him but not me. With that, I can upload the bootloader and communicate to the device via a direct usb console and even see some Baro data both from a FC and directly but a few things are out of sorts:
So the initial conclusion we came to is a change of hardware on the manufacturer side (possible but unlikely, we can check the pins and traces manually this week if need be) or as @dirksavage88 thinks, something on the nuttx side not being configured correctly. What’s the best thing to do at this point from a hardware standpoint? My binaries more pulled from the Ci artifacts and I put master on the FC from yesterday. |
@ryanjAA - did you ever share a bin file from @dirksavage88 build's deploy directory? It would be (nnnn.bin) where nnn is the board ID. What is the state of the bootloaders on each of your units? This goes the the params getting wiped if they are FLASH based. If you send me HW I can get this running for you. |
@davids5 the issue for the gps seems to be something going on with the GPS driver > PX4/PX4-GPSDrivers#82 |
@dirksavage88 I just built it from your repo and that has me on nuttx 8.2 so likely building from this pr will get it at nuttx 10 but still some issues as we discussed. seems the Baro temp is correct when viewed from the console on the node but not on the FC side. @davids5 - yes, he sent me a binary directly from his build but the boot loader was still from the artifact so nuttx version was different). Regarding the boot loader we synced up and tried the same and different ones, no dice which is strange on the GPS side (it's not hardware, checked ardu again for good measure). Still no mag which seems to be the top two reasons to use this unit but I'm sure it's just something mismatched. If you message me an address and I'll get one of these sent to you - that would be a big help. |
Also re Nuttx, I'm wondering if this: #18356 is occurring since I just pulled down master and built for a Pixhawk 4 and still reporting v 8.2 |
Signed-off-by: dirksavage88 <dirksavage88@gmail.com>
f37be63
to
4d8d51c
Compare
@dirksavage88 , @ryanjAA - I have made progress. There is a NuttX change that gets us a working console. Would you like me to do a continuation PR or push to this PR? |
@dirksavage88 FYI - first post had a typo in the @ |
I’m okay with a continuation PR. |
Continued here #19061 |
PR to get the Matek M9NF4 GPS can nodes integrated into uavcannode.
Problem Description:
Integration Matek M9NF4 GPS can nodes and board support
-includes Matek M9NF4 GPS w/ RM3100.
Link vendor page: http://www.mateksys.com/?portfolio=m9n-f4#tab-id-4
Immediate goal is to get a baseline working version merged, then continue iterating on full support
WIP, nodes need testing and integration. Boards includes onboard gps, magnetometer, compass, barometer, and IMU
Additional Info: uavcannode driver based implementation. User friendly bootloader flashing via DFU USB. STM32F405RGT6 similar to omnibus stm32f4 chip.