Test your Robus configuration
To adapt Luos engine to your board specificities, you need to configure it. This subject is covered in the Luos engine configuration. To validate your Robus network's hardware configuration, you can use a Robus tool called selftest available in the Luos engine's 'library.
Hardware test conditions
In order to allow selftest to check everything, you need to have specific conditions for your board. To make this test, only one board must be isolated (unconnected) from the network. Robus needs to be able to receive what it sends to check messages integrity and to catch collisions. To do that, you must have the TX and RX pins connected together, directly or through a driver. This is already the case in One Wire and RS485 configurations. You must also connect the PTP pins together.
Software conditions
To check the Robus access to the physical network, you need to create a specific binary file containing only the selftest program. This program will perform some checkups allowing you to validate your hardware configuration. To use the selftest tool, you have to define SELFTEST using "-D SELFTEST" GCC build flag.
If you use platformio IDE, you must add a "-D SELFTEST" directive in the buildflags setting (this can be found in the file _platformio.ini).
To finish, you need to add this in your main file:
#include "luos_engine.h"
#include "selftest.h"
void selftest_ok(void)
{
//selftest pass! your configuration is OK
}
void selftest_nok(void)
{
//selftest doesn't pass! your configuration is NOK
}
int main(void)
{
selftest_run(selftest_ok, selftest_nok);
}
Execution and validation
To know if your configuration is OK or not, you need to be able to know in which function (selftest_ok
or selftest_nok
) you will finish.
If you have debug capabilities, you can add breakpoints on these functions allowing you to analyse the call stack and precisely diagnose your test.
If not, you need to find a way to retrieve feedback such as a characteristic LED blink, for example.
The Selftest.c file shows you which part of the hardware communication is tested.
If NOK:
It can be a communication problem:
- Check your MCU frequency definition in LuosHAL_config and your setup (those must be equals)
- Check USART configuration (Pinout Rx/Tx, USART number, IRQ, Handler)
- Check the TIMER configuration (Channel, IRQ, Handler)
- Check the DMA configuration (Channel, IRQ, Handler)
It can be a PTP problem:
- Check your Pinout definition and IRQ for you PTP pin
- Check in dedicated files the handler for IRQ :::