mbed::Ticker + SPI to control X-Nucleo PLC don't work together?

27 Feb 2017

Hello.

I have a Nucleo-F334R8 with a X-NUCLEO PLC01A1 expansion board:

http://www.st.com/en/ecosystems/x-nucleo-plc01a1.html

https://developer.mbed.org/components/X-NUCLEO-PLC01A1-Programmable-Logic-Cont/

I am currently attempting to use multiple outputs in parallel, through the use of the mbed::Ticker class. I achieved blinking a LED and outputting from the DAC (starts at 0V, increments by 0.1V till 1V and resets to 0), however the PLC addon is giving me trouble.

The PLC's code that I use is a slightly modified version of the HelloWorld_PLC01A1 project.

I have simply added a main.h to my file that contains the function variable/function/class declarations. Stand-alone this works just like the regular Helloworld.

But when combined with the Ticker function it seems to remain stuck at it's starting phase. The red FAULT LED shines. To my understanding it is always on until the first time a signal is received. In the helloworld it also blinks for a fraction of second before immediately receiving a signal. Essentially my function is never really triggering properly.

note: I've changed the SPI_CLK pin from D13 to D3, because D13 also controls the LED. (see X_NUCLEO_PLC01A1/BSP/x_nucleo_plc01a1_config.h)

Here is my code:

the PLC receives 24V, and should output from all its exits. A 24V relay is connected to OUT1. The relay is tested and works in some other projects I have, so there are no broken components.

I've been struggling with this for a few days now, but I can't figure out how to make it work.

One of my possible conclusions is that the mbed library that I have is unsuitable to my needs, but I have no idea where to get one that does everything that I need.

I've been relying on the mbed-os library from the blinky led example in the cookbook. The Helloworld_PLC01A1 program does not work well when swapping it's own mbed.h out for this one. The same goes the other way around.

Is there some easy way to make my own mbed library that suits my needs?

What are my options here? Is there another way to make functions run parallel without the Ticker class? It seems that the PLC program also activates tickers on its own, so it shouldn't really be a limiting factor of the lib??

Please help me, I am at my wit's end :S