2019-10-21 12:06 AM
Hi,
I have generated the code using CUBEMX.
In my code i'm trying to send data over CAN and USART .
CAN is working as i have tested with my analyser but over USART sending some junk data.
is there any possibility that CANBUS and USART gets conflicted.i'm using STM32F7 and in that i'm using CAN1 and USART3
I have checked the baudrate is fine.
Thanks,
Vimal
2019-10-21 12:15 AM
I'm pretty sure both rely on interrupts with the same priority, and you do too much in interrupt context (callbacks).
Like calling UART output in the CAN callback.
Cube/Hal is not a good role model for an efficient and properly structured application.
And it surely doesn't relieve you from learning about the inner workings of the MCU and it's peripherals.
2019-10-21 12:36 AM
Also if you print from a live buffer the content might change.
2019-10-21 02:09 AM
I'm not doing anything other than printing data over UART even i have commented the CAN_Init() but still i'm having that problem
int main(void)
{
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MCU Configuration--------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* USER CODE BEGIN Init */
/* USER CODE END Init */
/* Configure the system clock */
SystemClock_Config();
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
// MX_CAN1_Init();
MX_USART3_UART_Init();
/* USER CODE BEGIN 2 */
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
HAL_UART_Transmit(&huart3, "Hello\n", 6, 1000);
HAL_Delay(1000);
}
/* USER CODE END 3 */
}
How do i check both the interrupt on the same priority? and Please suggest me where i can learn about the inner working of MCU ,is there any course or you can suggest to where to start from?
Thanks,
Vimal
2019-10-21 03:45 AM
Read the code, wether it's yours, or Cube-generated.
For things you don't understand, read the datasheet, reference manuals.
The M4 interrupt system is, if I remember correctly, just briefly treated in ST's documentation. You might need the ARM technical reference manuals as well.
Spent time learning during this project is gained experience and won time in all following projects.