Site Search

Yama-san's secret gadget

Article header analog discovery 300x196 1

Thank you very much for participating in the EFM32 microcomputer seminar held in July. Due to the popularity of this event, it will be held regularly, so please join us if you would like to speak directly with Mr. Yama.
Without further ado, I would like to write about PRS, one of the functions that realizes the ultra-low power consumption of EFM32 microcontrollers, in this article. The study session was postponed due to preparations for the seminar, but Mr. Yama taught me about PRS, which was difficult to understand. So, Mr. Yama, who started preparing for the study session, brought something new. I asked, "What is that black case next to the evaluation kit, Mr. Yama? Could it be Mr. Yama's personal belongings?" This was bought by the company, so it's fine." I heard that it is convenient for personal use, so the company also purchased it. What do you use it for even if you buy it individually? What are you doing at home on weekends? We started today with a surprise for Mr. Yama.

PRS (Peripheral Reflex System)

Article header rpsfigure 300x177 1

Have you ever seen the material on the right in the materials provided by Silicon Labs? PRS is one of the functions to reduce power consumption, and it seems that "built-in peripherals cooperate with each other and operate autonomously and automatically respond even when the CPU is stopped", but as far as I can see from the figure, I do not understand at all. It looks like each peripheral is connected by a bus, but I don't know how it works or how to set it. So Mr. Yama's explanation started from the basics.

PRS overview

Article header prs Reference Manual 300x200 3

It's a bit difficult to get an idea from the diagram shown above, so I asked for an explanation based on the schematic diagram in the reference manual. Instead of connecting peripherals like a bus, it has a structure that switches inputs with a multiplexer. The left side of PRS ch (output from peripheral) is called Reflex Producer, and the right side (input to peripheral) is called Reflex Consumer. There are multiple PRS channels, and the number is determined for each series regardless of the number of pins, so from 4 channels for the Zero and Happy Gecko series to 12 channels for the Leopard, Giant, and Wonder Gecko series.

Article header prs overview 300x312 2

 

Registers are allocated for PRS to be controlled by software, and it is possible to set Producer, Consumer peripheral selection, each edge detection method, etc. according to the application.
More detailed information can be found in the application note (AN0025), and a sample program is provided as described in the application note.
In addition to AN0025, the following application notes use PRS, so please refer to them when designing software.
- AN0012_efm32_gpio
- AN0021_efm32_adc
- AN0022_efm32_dac
- AN0064_efm32_idac

The points that Mr. Yama was passionate about

Thanks to Mr. Yama's explanation, I've come to understand how PRS works, how it works, and how to set it up. However, one question was posed by Mr. Yama. "PRS is supposed to run when the CPU is stopped. So how do we debug the behavior of PRS?"
It is exactly as Mr. Yama pointed out. I don't know how to debug because the CPU operates in a stopped state.

Article header prs behavior observation 800x520 1

Apparently, ch0 to 3 of the PRS channels can be output to GPIO regardless of the series.
The figure below is the material used by Mr. Yama for explanation. If you use the Configurator to generate the source like this, you can easily set the output to GPIO. If you are having trouble debugging PRS, please give it a try.

Article header prs gpio 800x571 1

Finally, Mr. Yama's secret gadget appears

Article header 400x263 1

The mysterious black case I wrote at the beginning appeared when the software was rewritten to output PRS to GPIO. When I started running this device and the dedicated software, Mr. Yama suddenly said, "Look, look, can you see that when a sine wave is input, it is output from GPIO? The CPU is in a stopped state because it breaks on the debugger. That's right!" he said excitedly. It's hard to see in the picture, but the PC screen shows the output sine wave on the right and the input waveform from the GPIO on the left. bottom.

I understood the greatness of the function that PRS thought about, but I didn't understand the points that fit Mr. Yama's point today.

I made a video about PRS, so please take a look.

Find out in 1 minute! "EFM32 PRS (Peripheral Reflex System)"-YouTube