cancel
Showing results for 
Search instead for 
Did you mean: 

How can I convert UART and I2C inputs to UART and CAN outputs?

Macun
Associate II

Hi, I’m new to STM32.

With STM32F730R8T6 MCU;

I want to see the data using CAN protocol and UART protocol while sending data using UART protocol.

At the same time, I want to see the data using CAN protocol and UART protocol while sending data using I2C protocol.

I need a sample study on this subject or a topic I can follow or any suggestions.

I don't want ready information, I don't want to be misunderstood.

If there is any resource that can help, I want to examine it.

I tried to visually explain the work I wanted to do with a photograph.

Thank you very much in advance.

7 REPLIES 7
TManiac
Associate III

What is your goal on sending on two communication paths?

There are examples from STM or many tutorials out on the world wide web (including youtube videos) to send messages on a communication path. Do one or two of them and you will be able to send a CAN message and to send on UART.

If you are good you find tutorials using DMA. And so you can do all the sending without any program line in the endless loop.

First of all, thank you for your answer.

I use two sensors. The first sensor gives UART output. The second sensor gives I2C output. I want to transmit these two outputs to the computer via USB.

At the same time, I want to transmit the data from the sensors via CAN.

Yes, there are many instructional videos on Youtube, but I couldn't find a video that takes input with UART and gives output with CAN. So I couldn't find a video that explains both together.

I have watched and understood videos about communication protocols communicating within themselves, but what I want to do is different, isn't it?

Take your sensor values and save it in a variable.

Take this variable to transmit on the communication of your which.

This is what programming a microcontroller is 😉

You can do all this inside the endless loop. Or you learn about OS and do it in tasks.

Is the data in a form you can forward or tunnel it over the alternate interface.

Are bandwidths sufficient to achieve this?

CAN uses small packets.

Otherwise you need to decide how to process the input data forms, and how you can represent them in a combined form suitable for the interface you are using, and what the end use of this data is.​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Great, thank you very much.

I know where to start my research. 

I will investigate if there will be delays, etc. 

Since I do not have enough knowledge and experience in this field, I could not understand your questions. 

Can you explain in more detail?

S.Ma
Principal

If you want to debug it, use STLink to pause the code of your uart amd can, and observe the ram buffer of each one.

Then use the live watch debug window to see buffers around once per 2 seconds.

Then use the uart to usb provided function on stlink built in nucleo or discovery board to export and log data using a printf method.

Each step will require you to learn and grow your embbeded coding skills....