Skip to content

HW test projects using embot environment: ems, mc4plus and amc #434

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

Merged
merged 7 commits into from
Nov 3, 2023

Conversation

marcoaccame
Copy link
Contributor

@marcoaccame marcoaccame commented Nov 2, 2023

This PR adds minimal HW test projects using the embot environment for the ems , the mc4plus and the amc boards.
The projects can be used as template / demonstrators for developing / testing new HW device drivers.

Description

The most recent boards use the embot environment and new code will be strongly preferred to be in C++ and to run in this environment.

So, it is normal that the HW test project for instance of the amc uses the embot environment. But is useful that also the ems and the mc4plus can use the embot features.

So, this PR adds some simple test programs for the ems and mc4plus that run the embot environment. The embot::hw layer runs on top of the legacy hal2.ems4rd.ethdbg.lib and hal2.mc4plus.ethdbg.lib hardware abstraction layer libraries. And then, the embot::os layer runs as usual.

As a result, the test projects on the three boards all share a common environment to explore some topics that may be of interest.

They all launch a periodic thread called tTEST that can init some HW module and then tick it regularly. The details of what each board does are in the following.

  • The mc4plus test project uses the HAL motor driver to impose a PWM to a motor and to read back the generated current. That can be the starting point for a beginner to understand how the TIM peripherals work to impose PWM and to retrieve ADC readings (such as the induced motor current) that are synchronized w/ the PWM.
  • The ems test project demonstrates CAN communication using the HAL driver in a manner similar to what happens in the control loop. The CAN frames are received in the background and are parsed all together periodically at each tick. After that, the outgoing CAN frames are sent to the channel.
  • The amc test project demonstrates CAN communication using the embot::hw::can driver and also how to configure the object embot::app::eth::theErrorManager to redirect its messages onto the CAN channel. That can be the starting point for instance to implement / test HW embot drivers for new high resolution SPI encoders.

Tests

All the projects have been tested using an ULINK Pro and an STlink. They work fine. I just attach a simple printscreen.

image
Figure. The tTEST thread flushes 8 CAN frames to the channel and we can see the 8 execution of the CAN IRQHandler FDCAN1_IT0.

Mergeability

This PR does not change any feature, it just adapts the mandatory embot::hw drivers so that they can work on top of hal2. So, it can be safely merged.

@marcoaccame marcoaccame marked this pull request as draft November 3, 2023 08:36
@marcoaccame marcoaccame changed the title HW test projects for ems and mc4plus using the embot environment Minimal HW test projects using embot environment: ems, mc4plus and amc Nov 3, 2023
@marcoaccame marcoaccame marked this pull request as ready for review November 3, 2023 13:45
@marcoaccame marcoaccame changed the title Minimal HW test projects using embot environment: ems, mc4plus and amc HW test projects using embot environment: ems, mc4plus and amc Nov 3, 2023
@marcoaccame marcoaccame merged commit f431a0e into robotology:devel Nov 3, 2023
@marcoaccame marcoaccame deleted the feat/embot-over-hal2 branch November 3, 2023 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant