how to simulate Sent_Protocl_signal? - simulink

I wanted to simulate the Sent_Protocol with an STM32 μC emulate as if I had a sensor. and represent this with an oscilloscope . I have to simulate this on Matlab and then connect with STM32. so i thought the signal should be like a normal PWM Signal look like.
So I wanted to ask if it is possible to generate a different pulse width in the same signal as in the above picture ?

Related

Reading 4-20ma transmitter stm32 adc

I try to use 4-20 ma pressure transmitter
With stm32 internal adc
Problem reading is flacuating too much I have to take average for 128-256 reading to take stable reading
Is that normal solution or there is other way to filter data and transmitter signal ??
Many reasons can affect the reading stability. Basically grounding, PCB layout, input cables, noise on the uController supply pins, input RC filter, the ADC code...
I have a similar application using a current resistor of 162R from input connector to the same ground of the ADC input. Than a series resistor of 22k and a ceramic capacitor of 47nF to ground, placed close to the ADC pin.
With that I take 10 ADC measures and make an average. Signal is stable.
Please, share your code and circuit diagram...

What is the most appropriate clock/time source for software-based signal processing?

Let's say I want to sample a pair of GPIO pins of my Raspberry Pi* with a frequency around 10kHz to feed a software-based signal analyzer (written in C for instance). What is the most appropriate method to obtain an accurate timestamp for each sample? Accurate means, the delay between acqiring the sample and reading the clock/time source should be at least constant or negligible at best. The signal analyzer does not necessarily operate in realtime.
I am aware that the sampling quality may also be affected by other circumstances (e.g. preemptive mulititasking), but the question is only about acuqiring an accurate timestamp for each sample.
*) In general: any signal like a pulse wave (high/low) or an audio signal (quantized). The Raspberry Pi is only an example, since it has everything to acquire the signal already built-in.

How to pulse generator block generate a pulse 40khz?

I tried to generate a 40khz pulse to the GPIO pin of my ultrasonic sensor in raspberry pi. I used the pulse generator instrumentation, but the pulse is not accurate: the oscilloscope displays only 10khz.
I modified configuration parameters:
fixed-step
sample time is auto/1e-08
solver is auto/discrete
I also have tried various ways to create a square pulse: function sign(sin(2*pi*40000t)), PLL block, repeating sequence, signal generator combined with sum, compare to zero, etc.
All of these display correctly on the scope, but do not deploy accurately.
I doubted the raspberry pulse generatior, so I used python to drive the GPIO pin; results are very accurate. I worry that the Simulink complier doesn't properly support raspberry or the sample time.
Any suggestions?
This is the model I used to generate 40khz pulse.
with period is 0.000025s,pulse width 50%, Solver type is fixed-step.
The oscilloscope display as the following figure:

Frequency issues in simulink interface with arduino

I'm trying to generate 6 PWM signals by comparing sine and triangular waves on simulink.In the scope I'm getting the frequency of PWM signals as 50 HZ. But when I deploy the model onto arduino, the frequency of the PWM signal is getting reduced to around 15 HZ .How to fix this ?
whether you've downloaded arduino library for matlab simulink? PWM output later on arduino digital pins are connected to the scope matlab

generating a waveform in matlab for rohde and schwarz signal generator

We are doing a test which consists in sending a waveform from Matlab to the signal generator SMB100A and sending it through a cable to the r&s spectrum analyzer just to have a channel. We set the trigger manually in the signal generator in the restart mode, then we set the frequency and the chip rate in our Matlab code as well as the buffer size and the connections. Finally, we read the waveform, which is already stored in the signal generator , and we set ARB state ON: we are using the arbitrary customized digital modulation. However, the channel impulse response is different every time that we run the test: there is a portion of the signal that looks like an offset; we think the signal is shifted because of an inversion in the phase. Any clue about why this happens?