1
\$\begingroup\$

I made a device with a stm32f107 and sim800l gsm module . Module is in data mode(PPP) and I'm using LWIP library . My MCU clocks at 72MHz .

My problem is that I get frame error and noise error when gsm module wants to send data. I tried to lower my baud rate step by step. Started from 115200 and at last I used 1200 bps(!!) but problem still exist and even its getting worst.

The funny thing is that I use a uart debug port to monitor my log and at the moment I get frame and noise error I get garbage in my terminal too.

here is my uart configuration

~~~
 GSM_UART_Handler.Instance = GSM_USART;
 GSM_UART_Handler.Init.BaudRate = baudrate;
 GSM_UART_Handler.Init.Mode = UART_MODE_TX_RX ;
 GSM_UART_Handler.Init.OverSampling = UART_OVERSAMPLING_16;
 GSM_UART_Handler.Init.HwFlowCtl = UART_HWCONTROL_NONE;
 GSM_UART_Handler.Init.Parity = UART_PARITY_NONE;
 GSM_UART_Handler.Init.StopBits = UART_STOPBITS_1;
 GSM_UART_Handler.Init.WordLength = UART_WORDLENGTH_8B;

 HAL_UART_Init(&GSM_UART_Handler);

 __HAL_UART_ENABLE_IT(&GSM_UART_Handler,UART_IT_IDLE);

 HAL_UART_Receive_DMA(&GSM_UART_Handler,DMA_Buffer,DMA_BUFFER_SIZE);

so here are my questions

How does MCU detect noise error?!

Is it possible my main clock source(crystal 8MHZ) deviate when GSM is in transmit mode? How can I see the deviation?(oscilloscope or Logic analyzer )?

May problem disappear if I lower my overall clock frequency (maybe 36 MHz)?

\$\endgroup\$
2
  • \$\begingroup\$ The RF from the GSM module is relatively strong (in the W range IIRC) and cold cause problems on the uart RX line if the latter was not shielded properly due to coupling. We would need to look at the layout, but you could just scope the signal. \$\endgroup\$
    – Turbo J
    Commented Aug 18, 2019 at 12:19
  • \$\begingroup\$ @TurboJ I come up with an answer and a soloution, I will post the soloution ,correct me if I'm wrong \$\endgroup\$
    – Alireza
    Commented Aug 18, 2019 at 15:16

2 Answers 2

3
\$\begingroup\$

So after watching my terminal for hours I realized something interesting!sometimes When ping request is sent to gsm module without any delay I get frame error and noise error.

In reference manual I understood that frame error occurs when mcu couldn't find stop bit and noise error occurs when sampling bits don't strongly prove 1 or zero (maybe I'm not completely true but it's somehow the same) and in uart protocol start bit is a zero after idle time.

So I doubted that transmit burst may cause a very short zero on RX line! So again I looked carefully at my schematic and hardware design document of Sim800l!

I've put 4 cap in parallel between vbat and gnd! 1 1000uF electrolyte,1 220uF tantalum, 1 33pF and 1 10pF. Data sheet recommended to place an other cap called Cb = 1uF too which I didn't put!!

So I started to experiment. I added 1 2200uF electrolyte cap too then realized that errors show up lesser than before! Then I added a 10uF ceramic cap and nothing happened again even garbage that was sent to my terminal!!

\$\endgroup\$
1
\$\begingroup\$

it is usual symptom of the wrong baud settings. It can by the STM32 or the GSM device. The easiest way is to connect the oscilloscope and see the UART waveforms. Measure the timings and you will calculate the baud. STM devices have a very good clocks and I personally did not have any problems using it.

Check also the system clock settings.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ it doesn't have problem all the time . just in GSM transmit . \$\endgroup\$
    – Alireza
    Commented Aug 18, 2019 at 10:10
  • \$\begingroup\$ is looking at uart waveforms enough to find out the problem or I need the sample signal too?! \$\endgroup\$
    – Alireza
    Commented Aug 18, 2019 at 10:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.