The error occured on CANMessage at NUCLEO-F303K8

kanato_N
Tue, 25 Jul 2023 08:39:13 +0000
Bugs

Hi, forum,
I tried to receive the CANMessage data on NUCLEO-F303K8, but I couldn’t do that. So, I tried to send data to confirm whether the CANMessage is available or not.
When I tried to send data, I made an error when I tried to build this sample code for a CAN on NUCLEO-F303K8. Therefore, I suspect that there is some problem in CANMessag class but, I don’t know why.
I’m really happy if someone teaches the cause of this problem and, how to solve this problem.

This is my developing environment.
Compilar: Keil Studio Cloud
Os: Mbed OS2
Board: NUCLEO-F303K8
CAN transceiver : MCP2561, MCP2562

This is a sample code.

#include “mbed.h”

Serial pc(USBTX,USBRX,115200);
CAN can(PA_11, PA_12);
DigitalOut led(PA_10);

unsigned char counter=0;

int main(void){
while(1){
can.write(CANMessage(1227, &counter, 1));
counter++;
led = !led;
pc.printf(“Message sent:%d”,counter);
wait(1);
}
}

This is the error message.

Build started
Using toolchain ARM_STD profile {‘ENV’: {‘ARMLMD_LICENSE_FILE’: ‘8224@10.100.166.33:8224@10.100.120.118’}, ‘PATHS’: {‘ARMC6_PATH’: ‘/opt/ARMCompiler6.15.13/bin/’, ‘ARM_PATH’: ‘/opt/armcc5_06_u6/’}, ‘common’: [‘-c’, ‘–gnu’, ‘-O3’, ‘-Otime’, ‘–split_sections’, ‘–apcs=interwork’], ‘cxx’: [‘–cpp’, ‘–no_rtti’], ‘COMPILE_C_AS_CPP’: False, ‘NEW_SCAN_RESOURCES’: True}
scan /tmp/chroots/ch-d55a0cdd-8467-46b4-8fa3-c85acd3cae91/src
scan /tmp/chroots/ch-d55a0cdd-8467-46b4-8fa3-c85acd3cae91/extras/mbed
Configuration error: ‘static_memory_defines’ is not defined.
#289: no instance of constructor “mbed::CANMessage::CANMessage” matches the argument list
#1-D: last line of file ends without a newline
“/src/main.cpp”, line 12: Error: #289: no instance of constructor “mbed::CANMessage::CANMessage” matches the argument list
argument types are: (int, unsigned char *, int)
can.write(CANMessage(1227, &counter, 1));
^
“/src/main.cpp”, line 20: Warning: #1-D: last line of file ends without a newline
}
^
/src/main.cpp: 1 warning, 1 error
Internal error.
Build failed
Build failed
compile main.cpp

Best Regards,

3 posts - 2 participants