I am trying to write a program, which will read data from add-on card via UART2 using FCM.
At first I decided to write a simple test, which will configure the port, subscribe to FCM, switch to data mode and trace the events. All functions return OK, but as a result I can see traces of only two events: “opened” and “data mode”. The data should come regularly - but there is nothing.
In one of my attempts to make it work I moved all preparation stages to another task. And suddenly everything started to work!
Is it normal? I do not remember mentioning in the documentation that FCM should be subscribed from a non-main task. Or did I miss it?
You can subscribe to FCM service from main task itself. You can refer to SDK samples for more information……
What exactly are you doing in your application?
Yes, I’ve seen SDK samples and I’ve searched the forum for FCM samples.
I will describe the situation once again in more detail.
I have an add-on card which is inserted into my FXT009 modem (firmware 7.52). It collects wireless M-BUS data from sensors and sends it to UART2 port.
My test application does nothing special. It simply configures UART2 port with the settings required by my card and calls adl_fcmSubscribe and adl_fcmSwitchV24State to switch to data mode. Control event handler traces the event. Data event handler traces the size of data.
So, if I do all this in main task, everything runs without any errors, I can see that ADL_FCM_EVENT_FLOW_OPENNED and ADL_FCM_EVENT_V24_DATA_MODE events are fired. And nothing else, no more activity.
But if I add another task to my program and do all the same in it, then data events start firing each time when data comes from the sensors.
Could it be some feature of the card I am using?