cancel
Showing results for 
Search instead for 
Did you mean: 

8 PWM, 8 A/D, serial and more. Can this be done with the STM32F030C8Tx?

martincho
Associate II

I have an application that requires a low BOM cost, hence my selection of the STM32F030C8Tx.

My requirements are as follows:

2 UARTs operating at a maximum rate of 115200

1 UART operating at a rate between 9600 and 115200

8 PWM outputs, 8 bits is fine, anywhere between 1 kHz and 10 kHz is OK

8 A/D inputs, 10 bit resolution is fine

1 I2C channel

1 SPI channel

2 Digital outputs

2 Digital inputs

Internal clock will likely be maxed out at 48 MHz unless I can get away with less.

The STM32F030C8Tx only has two UARTs. Since the third serial port is only for debugging I was planning on bit-banging it. My guess is I should be able to do 9600 no problem. Again, debug only.

The problem seems to be in the requirement to have 8 PWM's and 8 A/D's at the same time. I quickly start losing the ability to have one or the other.

My first thought was, OK, bit-bang the PWM outputs as well. If using a timer interrupt this would be a 256 kHz interrupt, which gives me 3.9 microseconds to make eight comparisons and toggle outputs as necessary. I'll have a Nucleo board in hand next week to test this hypothesis. That's roughly 230 instructions per PWM tick...with a degree of intelligent coding I likely don't have to drive the pins at 256 kHz. In other words, I only have to address transitions.

What I don't understand with the timers is this setting of "PWM without output" in MX. Googling for this produces a pile of unrelated results.

If I can use this mode to produce eight interrupts at the counter timeout (or transitions) this would be perfect. I can tolerate jitter at all PWM edges, which means I can take my time servicing the outputs.

If this "PWM without output" approach works, I can then map the digital outputs any way I want and get the eight A/D inputs at the same time. The serial ports would then not be an issue either. If I don't have the clock cycles to bit-bang a UART I can easily set it up to use an external SPI or I2C UART for development purposes.

I think that pretty much defines it. I am not super familiar with this architecture and tools (migrating products from other architectures to STM32-land) and don't have a tangible sense of what might be possible.

Any and all advice on this would be appreciated.

Thanks,

-Martin

13 REPLIES 13

Quick question. This doesn't seem to be obvious from the Segger page. Is RTT additional software you have to license/pay for or is it simply software you can use if you own a J-Link probe?

Thanks.

Simply break code instead printf and you see all info over SingleWireDebug.

But yes exist situation when you need uart print ...

The RTT tools (Viewer, Client, Logger) are included in J-Link Software and Documentation Pack, for which the following is true:

Can be downloaded and used free of charge by any owner of a SEGGER J-Link, J-Trace or Flasher model.

And the RTT feature itself is included for all J-Link probes:

https://www.segger.com/products/debug-probes/j-link/models/model-overview/

Thanks. I reached out to Segger and got confirmation of this as well. Sounds like a good plan.