# US 2022/0286319 A1 · Microcontroller circuit, corresponding device, system and method of operation

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2022/0286319 A1
- Document ID: US20220286319A1
- Status: Published application
- Kind: A1
- Application number: 17/677,113
- Filed: 2022-02-22
- Published: 2022-09-08
- Earliest claimed: 2021-03-08
- Assignees: STMicroelectronics Design and Application S.R.O.; Stmicroelectronics Application GmbH
- Applicants: STMicroelectronics Design and Application S.R.O.; STMicroelectronics Application GMBH
- Inventors: Fred Rennig; Vaclav Dvorak
- Web page: https://patentgrep.com/patent/US20220286319A1

## CPC

- H04L 12/403: with centralised control, e.g. polling
- H03K 7/08: Duration or width modulation {; Duty cycle modulation}
- H04L 12/40006: {Architecture of a communication node (current supply arrangements H04L12/10; intermediate storage or scheduling H04L49/90)}
- H04L 2012/40215: {Controller Area Network CAN}
- H04L: TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION (arrangements common to telegraphic and telephonic communication H04M)
- H03K: PULSE TECHNIQUE (measuring pulse characteristics G01R; modulating sinusoidal oscillations with pulses H03C; transmission of digital information H04L; discriminator circuits detecting phase difference between two signals by counting or integrating cycles of oscillation H03D3/04; automatic control, starting, synchronisation or stabilisation of generators of electronic oscillations or pulses where the type of generator is irrelevant or unspecified H03L; coding, decoding or code conversion, in general H03M)

## Abstract

A circuit includes a first and a second memory, a processor and a timer. The processor generates a sequence of bits encoding a CAN frame and processes the sequence of bits to detect a sequence of PWM periods. The processor stores values of a first parameter of the PWM periods into the first memory, and values of a second parameter of the PWM periods into the second memory. The timer comprises a first register which reads from the first memory a value of the first parameter of a current PWM period. The timer comprises a counter which increases a count number and resets the count number as a function of the value of the first register.

## Claims

### Claim 1

A circuit, comprising:
a first memory and a second memory;
a processor coupled to the first memory and the second memory, the processor configured to:
generate an output sequence comprising binary values encoding an outgoing Controller Area Network (CAN) frame according to a CAN protocol,
process the output sequence to detect a sequence of ordered pulse-width modulated (PWM) periods, each PWM period comprising a first portion having a dominant state and a second portion having a recessive state, each PWM period having a respective total duration and a respective duty-cycle value,
store a set of ordered first values indicative of a first parameter of the PWM periods in the sequence of ordered PWM periods in the first memory, and
store a set of ordered second values indicative of a second parameter of the PWM periods in the sequence of ordered PWM periods in the second memory, wherein the first parameter and the second parameter define a shape of the PWM periods; and
a timer circuit comprising:
a first register configured to read from the first memory and store a value indicative of the first parameter of a current PWM period in the sequence of ordered PWM periods;
a counter circuit configured to:
increase an internal count number and reset the internal count number as a function of the value stored in the first register,
trigger reading from the first memory, and
trigger storing into the first register a subsequent value indicative of the first parameter of a subsequent PWM period in the sequence of ordered PWM periods as a function of the value stored in the first register; and
a second register configured to:
read from the second memory and store a value indicative of the second parameter of the current PWM period,
compare the internal count number of the counter circuit to the value stored into the second register,
drive an output pin of the circuit to a dominant value or to a recessive value as a function of the comparing the internal count number of the counter circuit to the value stored into the second register, the output pin providing an output PWM signal comprising the sequence of ordered PWM periods,
read from the second memory, and
store a subsequent value indicative of the second parameter of a subsequent PWM period in the sequence of ordered PWM periods in response to the internal count number of the counter circuit reaching the value stored into the second register or in response to the internal count number of the counter circuit reaching the value stored into the first register.

### Claim 2 (depends on 1)

The circuit of claim 1, wherein the first parameter of the PWM periods is the total duration of the PWM periods and the second parameter of the PWM periods is the duration of the first portions of the PWM periods.

### Claim 3 (depends on 2)

The circuit of claim 2, wherein the counter circuit is configured to:
increase an internal count number until reaching the value stored in the first register;
reset the internal count number in response to the internal count number reaching the value stored into the first register;
trigger reading from the first memory; and
trigger storing into the first register a subsequent value indicative of the total duration of a subsequent PWM period in the sequence of ordered PWM periods.

### Claim 4 (depends on 3)

The circuit of claim 3, wherein the second register is configured to:
drive the output pin of the circuit to a dominant value in response to the internal count number of the counter circuit being lower than the value stored in the second register; and
drive the output pin of the circuit to a recessive value in response to the internal count number of the counter circuit exceeding the value stored into the second register.

### Claim 5 (depends on 1)

The circuit of claim 1, wherein generating the output sequence comprises:
generating a raw CAN frame comprising an identification field, a data length code field, a payload field, and one or more control bits;
applying bit stuffing processing to the raw CAN frame to produce a bit stuffed raw CAN frame;
calculating a cyclic redundancy check (CRC) code as a function of the bit stuffed raw CAN frame; and
inserting the calculated CRC code into the bit stuffed raw CAN frame.

### Claim 6 (depends on 1)

The circuit of claim 1, wherein processing the output sequence comprises:
detecting a start-of-frame bit having a dominant value in the output sequence;
counting a first number of consecutive bits having a dominant value in the output sequence until detecting a first bit having a recessive value;
counting a second number of consecutive bits having a recessive value in the output sequence until detecting a first bit having a dominant value; and
repeating the counting the first number and the counting the second number until having detected and processed an end-of-frame field in the output sequence.

### Claim 7 (depends on 1)

The circuit of claim 1, further comprising:
a first direct memory access (DMA) controller configured to execute a DMA memory transfer of a subsequent first value of the set of ordered first values from the first memory to the first register in response to the internal count number of the counter circuit reaching the value stored into the first register; and
a second DMA controller configured to execute a DMA memory transfer of a subsequent second value of the set of ordered second values from the second memory to the second register in response to the internal count number of the counter circuit reaching the value stored into the second register or in response to the internal count number of the counter circuit reaching the value stored into the first register.

### Claim 8 (depends on 7)

The circuit of claim 7, wherein the processor is configured to:
count a number of the PWM periods in the sequence of ordered PWM periods;
configure the first DMA controller to execute a number of DMA transfers from the first memory to the first register equal to the counted number of PWM periods; and
configure the second DMA controller to execute a number of DMA transfers from the second memory to the second register equal to the counted number of PWM periods.

### Claim 9 (depends on 8)

The circuit of claim 8, wherein the first DMA controller or the second DMA controller are configured to issue an interrupt signal towards the processor in response to the respective number of DMA transfers executed being equal to the counted number of PWM periods.

### Claim 10 (depends on 1)

The circuit of claim 1, wherein the processor is configured to:
store into the first memory an additional last value of the set of ordered first values, the additional last value being higher than any other value stored into the first memory; and
store into the second memory an additional last value of the set of ordered second values, the additional last value being equal to zero.

### Claim 11 (depends on 1)

The circuit of claim 1, further comprising a third memory and a fourth memory, wherein the timer circuit further includes:
an edge detector circuit coupled to an input pin of the circuit, the input pin configured to receive an input PWM signal conveying an incoming CAN frame encoded according to a CAN protocol, the edge detector circuit configured to provide a first output signal indicative of falling edges detected in the input PWM signal and a second output signal indicative of rising edges detected in the input PWM signal;
a third register configured to capture a current count number of the counter circuit in response to a falling edge detected in the PWM signal; and
a fourth register configured to capture a current count number of the counter circuit in response to a rising edge detected in the PWM signal, wherein the counter circuit is configured to reset the internal count number in response to a falling edge detected in the input PWM signal.

### Claim 12 (depends on 11)

The circuit of claim 11, wherein the circuit includes:
a third DMA controller configured to execute a DMA memory transfer of a current value stored into the third register to the third memory in response to a falling edge detected in the PWM signal and storing into the third memory a set of ordered third values indicative of the first parameter of the PWM periods in a respective sequence of ordered PWM periods of the input PWM signal, and
a fourth DMA controller configured to execute a DMA memory transfer of a current value stored into the fourth register to the fourth memory in response to a rising edge detected in the PWM signal and storing into the fourth memory a set of ordered fourth values indicative of the second parameter of the PWM periods in the respective sequence of ordered PWM periods of the input PWM signal, wherein the processor is configured to process the set of ordered third values and the set of ordered fourth values to generate an input sequence of binary values encoding the incoming CAN frame.

### Claim 13 (depends on 12)

The circuit of claim 12, wherein processing the set of ordered third values and the set of ordered fourth values comprises:
reading a third value from the set of ordered third values and adding to the read third value a clock tolerance value to produce a corresponding adjusted third value;
dividing the adjusted third value by a time value indicative of an expected duration of a single bit transmitted by the incoming CAN frame to produce an integer value indicative of a total number of bits in a current PWM period;
reading a fourth value from the set of ordered fourth values corresponding to the read third value, and dividing the fourth value by the time value indicative of the duration of a single bit transmitted by the incoming CAN frame to produce an integer value indicative of a number of bits having a dominant state in the current PWM period;
subtracting the integer value indicative of a number of bits having a dominant state in the current PWM period from the integer value indicative of a total number of bits in a current PWM period to produce an integer value indicative of a number of bits having a recessive state in the current PWM period;
generating a sequence of bits comprising the number of bits having a dominant state and the number of bits having a recessive state; and
repeating the reading the third value, dividing, reading the fourth value, subtracting, and generating until having processed a last third value stored in the third memory and a last fourth value stored in the fourth memory.

### Claim 14 (depends on 12)

The circuit of claim 12, wherein the processor is configured to:
store the input sequence of binary values into a first buffer;
remove stuffing bits from the input sequence of binary values to generate a de-stuffed input sequence of binary values;
store the de-stuffed input sequence of binary values into a second buffer;
extract data conveyed by the incoming CAN frame from the de-stuffed input sequence of binary values stored into the second buffer; and
check validity of a CRC code as a function of the input sequence of binary values stored into the first buffer.

### Claim 15 (depends on 12)

The circuit of claim 12, wherein the timer circuit comprises a fifth register configured to:
compare the internal count number of the counter circuit to a threshold value stored into the fifth register; and
issue an interrupt signal towards the processor in response to the internal count number of the counter circuit reaching the threshold value.

### Claim 16

A device, comprising a circuit, the circuit comprising:
a first memory and a second memory;
a processor coupled to the first memory and the second memory, the processor configured to:
generate an output sequence comprising binary values encoding an outgoing Controller Area Network (CAN) frame according to a CAN protocol,
process the output sequence to detect a sequence of ordered pulse-width modulated (PWM) periods, each PWM period comprising a first portion having a dominant state and a second portion having a recessive state, each PWM period having a respective total duration and a respective duty-cycle value,
store a set of ordered first values indicative of a first parameter of the PWM periods in the sequence of ordered PWM periods in the first memory, and
store a set of ordered second values indicative of a second parameter of the PWM periods in the sequence of ordered PWM periods in the second memory, wherein the first parameter and the second parameter define a shape of the PWM periods; and
a CAN transceiver couplable to a CAN bus, wherein an output pin of the circuit is configured to drive the CAN transceiver to transmit over the CAN bus outgoing CAN frames encoded according to a CAN protocol.

### Claim 17 (depends on 16)

The device of claim 16, wherein the circuit further comprises a timer circuit comprising:
a first register configured to read from the first memory and store a value indicative of the first parameter of a current PWM period in the sequence of ordered PWM periods;
a counter circuit configured to:
increase an internal count number and reset the internal count number as a function of the value stored in the first register,
trigger reading from the first memory, and
trigger storing into the first register a subsequent value indicative of the first parameter of a subsequent PWM period in the sequence of ordered PWM periods as a function of the value stored in the first register; and
a second register configured to:
read from the second memory and store a value indicative of the second parameter of the current PWM period,
compare the internal count number of the counter circuit to the value stored into the second register,
drive an output pin of the circuit to a dominant value or to a recessive value as a function of the comparing the internal count number of the counter circuit to the value stored into the second register, the output pin providing an output PWM signal comprising the sequence of ordered PWM periods,
read from the second memory, and
store a subsequent value indicative of the second parameter of a subsequent PWM period in the sequence of ordered PWM periods in response to the internal count number of the counter circuit reaching the value stored into the second register or in response to the internal count number of the counter circuit reaching the value stored into the first register.

### Claim 18 (depends on 17)

The device of claim 17, wherein the input pin of the circuit is configured to receive from the CAN bus via the CAN transceiver incoming CAN frames encoded according to the CAN protocol.

### Claim 19 (depends on 17)

The device of claim 17, wherein the first parameter of the PWM periods is the total duration of the PWM periods and the second parameter of the PWM periods is the duration of the first portions of the PWM periods.

### Claim 20

A method, comprising:
generating an output sequence of binary values encoding an outgoing CAN frame according to a CAN protocol;
processing the output sequence of binary values to detect a sequence of ordered PWM periods, each PWM period comprising a first portion having a dominant state and a second portion having a recessive state, each PWM period having a respective total duration and a respective duty-cycle value;
storing into a first memory a set of ordered first values indicative of a first parameter of the PWM periods in the sequence of ordered PWM periods;
storing into a second memory bank a set of ordered second values indicative of a second parameter of the PWM periods in the sequence of ordered PWM periods, wherein the first parameter and the second parameter define a shape of the PWM periods;
reading from the first memory and storing into a first register a value indicative of the first parameter of a current PWM period in the sequence of ordered PWM periods;
increasing an internal count number of a counter circuit and resetting the internal count number of the counter circuit as a function of the value stored in the first register;
reading from the first memory and storing into the first register a subsequent value indicative of the first parameter of a subsequent PWM period in the sequence of ordered PWM periods as a function of the value stored in the first register;
reading from the second memory and storing into a second register a value indicative of the second parameter of the current PWM period;
comparing the internal count number of the counter circuit to the value stored into the second register;
driving an output pin to a dominant value or to a recessive value as a function of the comparing the internal count number of the counter circuit to the value stored into the second register, wherein the output pin provides an output PWM signal comprising the sequence of ordered PWM periods; and
reading from the second memory and storing into the second register a subsequent value indicative of the second parameter of a subsequent PWM period in the sequence of ordered PWM periods in response to the internal count number of the counter circuit reaching the value stored into the second register or in response to the internal count number of the counter circuit reaching the value stored into the first register.
