Freertos with teensy 4.0

revati

Active member
Hi all,
currently I am working on teensy4.0 board with freertos but not getting which library i should use for freertos .Getting warning after added .zip file
WARNING: library FreeRTOS-Teensy4 claims to run on teensy architecture(s) and may be incompatible with your current board which runs on avr architecture(s).
 
When I am creating a task with Freertos ,task is not getting created properly so it is not calling that task_function.how I can resolve this error.
 
When I am creating a task with Freertos ,task is not getting created properly so it is not calling that task_function.how I can resolve this error.
Without seeing your code, the best anyone can do is guess. Please show a small program that illustrates the problem.
 
TaskHandle_t *receive_handle = NULL;
TaskHandle_t *transmit_handle = NULL;
void Receive_msg(void *pvParameters)
{

Serial.print("Receive_msg");
}
void transmit_msg(void *pvParameters)
{

Serial.print("transmit_msg");
}
void setup(void)
{
Serial.begin(115200);
Serial.print("Create task");
xTaskCreate(transmit_msg, "TransmitMsg", 100, NULL, 1, receive_handle);
xTaskCreate(Receive_msg, "ReceiveMsg", 100, NULL, 2, transmit_handle);
vTaskStartScheduler();
}
void loop(void)
{

}
this is basic code two create two tasks and printing normal prints after this works i want to modify task but basic task is not creating and not printing anything.
 
if (xTaskCreate(Task1, // Task function
"task1", // Task name
128, // Stack size (words, not bytes)
NULL, // Task parameters
1, // Priority
NULL // Task handle (will hold the control block pointer)
) != pdPASS)
{ // Check if task creation succeeded
printf("Failed to create task!\n");
}
else
{
printf("Task created successfully!\n");
}
after this it is printing task created successfully
 
Is it ok that both are using Serial.print("); ?
Generally, interrupt/multitask doing that causes grief.

Perhaps have the Transmit() use pinMode OUTPUT for LED_BUILTIN and do a digitalToggle(LED_BUILTIN), and not share USB print.
 
and one more doubt can i use flexcan library and freertos library both together because when i am trying to use i am getting errors in flexcan library
In file included from C:\Users\ADMIN\.platformio\packages\framework-arduinoteensy\libraries\Wire/Wire.h:26,
from .pio\libdeps\teensy40\freertos-teensy\src/arduino_freertos.h:40,
from src\main.cpp:3:
C:\Users\ADMIN\.platformio\packages\framework-arduinoteensy\libraries\Wire/WireIMXRT.h: In member function 'TWBRemulation& TWBRemulation::eek:perator=(int)':
C:\Users\ADMIN\.platformio\packages\framework-arduinoteensy\libraries\Wire/WireIMXRT.h:205:48: warning: unused parameter 'val' [-Wunused-parameter]
205 | inline TWBRemulation & operator = (int val) __attribute__((always_inline)) {
| ~~~~^~~
In file included from C:\Users\ADMIN\.platformio\packages\framework-arduinoteensy-ts\teensy4/Stream.h:24,
from C:\Users\ADMIN\.platformio\packages\framework-arduinoteensy-ts\teensy4/HardwareSerial.h:115,
from .pio\libdeps\teensy40\freertos-teensy\src/arduino_freertos.h:36:
C:/Users/ADMIN/.platformio/packages/framework-arduinoteensy/libraries/SdFat/src/common/ArduinoFiles.h: In instantiation of 'class PrintFile<FsBaseFile>':
C:\Users\ADMIN\.platformio\packages\framework-arduinoteensy\libraries\SdFat\src/SdFat.h:495:23: required from here
C:\Users\ADMIN\.platformio\packages\framework-arduinoteensy-ts\teensy4/Print.h:61:24: warning: 'virtual size_t Print::write(const uint8_t*, size_t)' was hidden [-Woverloaded-virtual=]
61 | virtual size_t write(const uint8_t *buffer, size_t size);
| ^~~~~
In file included from C:\Users\ADMIN\.platformio\packages\framework-arduinoteensy\libraries\SdFat\src/ExFatLib/ExFatFile.h:821,
from C:\Users\ADMIN\.platformio\packages\framework-arduinoteensy\libraries\SdFat\src/ExFatLib/ExFatVolume.h:27,
from C:\Users\ADMIN\.platformio\packages\framework-arduinoteensy\libraries\SdFat\src/ExFatLib/ExFatLib.h:27,
from C:\Users\ADMIN\.platformio\packages\framework-arduinoteensy\libraries\SdFat\src/SdFat.h:35,
from .pio\libdeps\teensy40\freertos-teensy\src/arduino_freertos.h:49:
C:/Users/ADMIN/.platformio/packages/framework-arduinoteensy/libraries/SdFat/src/common/ArduinoFiles.h:53:10: note: by 'PrintFile<FsBaseFile>::write'
53 | size_t write(uint8_t b) {
| ^~~~~
C:\Users\ADMIN\.platformio\packages\framework-arduinoteensy\libraries\SdFat\src\ExFatLib\ExFatPartition.cpp: In member function 'bool ExFatPartition::init(FsBlockDevice*, uint32_t, uint32_t)':
C:\Users\ADMIN\.platformio\packages\framework-arduinoteensy\libraries\SdFat\src\ExFatLib\ExFatPartition.cpp:327:78: warning: unused parameter 'numSectors' [-Wunused-parameter]
327 | bool ExFatPartition::init(FsBlockDevice* dev, uint32_t firstSector, uint32_t numSectors) {
| ~~~~~~~~~^~~~~~~~~~
In file included from src\main.cpp:4:
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4.h: In member function 'virtual bool CANListener::frameHandler(CAN_message_t&, int, uint8_t)':
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4.h:313:47: warning: unused parameter 'frame' [-Wunused-parameter]
313 | virtual bool frameHandler (CAN_message_t &frame, int mailbox, uint8_t controller) { return false; }
| ~~~~~~~~~~~~~~~^~~~~
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4.h:313:58: warning: unused parameter 'mailbox' [-Wunused-parameter]
313 | virtual bool frameHandler (CAN_message_t &frame, int mailbox, uint8_t controller) { return false; }
| ~~~~^~~~~~~
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4.h:313:75: warning: unused parameter 'controller' [-Wunused-parameter]
313 | virtual bool frameHandler (CAN_message_t &frame, int mailbox, uint8_t controller) { return false; }
| ~~~~~~~~^~~~~~~~~~
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4.h: In member function 'virtual void CANListener::txHandler(int, uint8_t)':
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4.h:314:33: warning: unused parameter 'mailbox' [-Wunused-parameter]
314 | virtual void txHandler (int mailbox, uint8_t controller) {;} /* unused in Collin's library */
| ~~~~^~~~~~~
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4.h:314:50: warning: unused parameter 'controller' [-Wunused-parameter]
314 | virtual void txHandler (int mailbox, uint8_t controller) {;} /* unused in Collin's library */
| ~~~~~~~~^~~~~~~~~~
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4.h: At global scope:
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4.h:534:5: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
534 | volatile bool fifo_filter_match(uint32_t id);
| ^~~~~~~~
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4.h:536:5: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
536 | volatile void frame_distribution(CAN_message_t &msg);
| ^~~~~~~~
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4.h:539:5: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
539 | volatile bool filter_match(FLEXCAN_MAILBOX mb_num, uint32_t id);
| ^~~~~~~~
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4.h: In member function 'uint8_t FlexCAN_T4<_bus, _rxSize, _txSize>::setRFFN(uint8_t)':
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4.h:488:72: warning: there are no arguments to 'constrain' that depend on a template parameter, so a declaration of 'constrain' must be available [-fpermissive]
488 | uint8_t setRFFN(uint8_t rffn) { return setRFFN((FLEXCAN_RFFN_TABLE)constrain(rffn, 0, 15)); }
| ^~~~~~~~~
In file included from .pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4.h:561:
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4.tpp: In member function 'void FlexCAN_T4<_bus, _rxSize, _txSize>::mailboxStatus()':
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4.tpp:272:20: warning: there are no arguments to 'constrain' that depend on a template parameter, so a declaration of 'constrain' must be available [-fpermissive]
272 | Serial.println(constrain((uint8_t)(FLEXCANb_MAXMB_SIZE(_bus) - remaining_mailboxes), 0, 32));
| ^~~~~~~~~
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4.tpp:311:55: error: 'HEX' was not declared in this scope; did you mean 'arduino::HEX'?
311 | Serial.print("(ID: 0x"); Serial.print(id, HEX); Serial.print(")");
| ^~~
| arduino::HEX
.pio\libdeps\teensy40\freertos-teensy\src/arduino_freertos.h:192:26: note: 'arduino::HEX' declared here
192 | static constexpr uint8_t HEX { 16 };
| ^~~
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4.tpp:368:53: error: 'HEX' was not declared in this scope; did you mean 'arduino::HEX'?
368 | Serial.print("(ID: 0x"); Serial.print(id, HEX); Serial.print(")");
| ^~~
| arduino::HEX
.pio\libdeps\teensy40\freertos-teensy\src/arduino_freertos.h:192:26: note: 'arduino::HEX' declared here
192 | static constexpr uint8_t HEX { 16 };
| ^~~
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4.tpp: In member function 'void FlexCAN_T4<_bus, _rxSize, _txSize>::setMaxMB(uint8_t)':
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4.tpp:447:10: warning: there are no arguments to 'constrain' that depend on a template parameter, so a declaration of 'constrain' must be available [-fpermissive]
447 | last = constrain(last,1,64);
| ^~~~~~~~~
Archiving .pio\build\teensy40\lib854\libSPI.a
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4.tpp: In member function 'uint8_t FlexCAN_T4<_bus, _rxSize, _txSize>::setRFFN(FLEXCAN_RFFN_TABLE)':
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4.tpp:1384:10: warning: there are no arguments to 'constrain' that depend on a template parameter, so a declaration of 'constrain' must be available [-fpermissive]
1384 | return constrain((uint8_t)(FLEXCANb_MAXMB_SIZE(_bus) - remaining_mailboxes), 0, 32);
| ^~~~~~~~~
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4.tpp: At global scope:
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4.tpp:1505:11: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
1505 | FCTP_FUNC volatile bool FCTP_OPT::fifo_filter_match(uint32_t id) {
| ^~~~~~~~
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4.tpp:1524:11: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
1524 | FCTP_FUNC volatile bool FCTP_OPT::filter_match(FLEXCAN_MAILBOX mb_num, uint32_t id) {
| ^~~~~~~~
Compiling .pio\build\teensy40\lib7eb\SdFat\FatLib\FatFileLFN.cpp.o
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4.tpp:1703:11: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
1703 | FCTP_FUNC volatile void FCTP_OPT::frame_distribution(CAN_message_t &msg) {
| ^~~~~~~~
Compiling .pio\build\teensy40\lib7eb\SdFat\FatLib\FatFilePrint.cpp.o
In file included from .pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4.h:564:
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4FD.tpp: In member function 'uint8_t FlexCAN_T4FD<_bus, _rxSize, _txSize>::setRegions(uint8_t)':
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4FD.tpp:95:8: warning: there are no arguments to 'constrain' that depend on a template parameter, so a declaration of 'constrain' must be available [-fpermissive]
95 | if ( constrain(size, 8, 64) == 8 ) {
| ^~~~~~~~~
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4FD.tpp:98:13: warning: there are no arguments to 'constrain' that depend on a template parameter, so a declaration of 'constrain' must be available [-fpermissive]
98 | else if ( constrain(size, 16, 64) == 16 ) {
| ^~~~~~~~~
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4FD.tpp:102:13: warning: there are no arguments to 'constrain' that depend on a template parameter, so a declaration of 'constrain' must be available [-fpermissive]
102 | else if ( constrain(size, 32, 64) == 32 ) {
| ^~~~~~~~~
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4FD.tpp: In member function 'uint8_t FlexCAN_T4FD<_bus, _rxSize, _txSize>::setRegions(uint8_t, uint8_t)':
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4FD.tpp:118:8: warning: there are no arguments to 'constrain' that depend on a template parameter, so a declaration of 'constrain' must be available [-fpermissive]
118 | if ( constrain(mbdsr0, 8, 64) == 8 ) {
| ^~~~~~~~~
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4FD.tpp:121:13: warning: there are no arguments to 'constrain' that depend on a template parameter, so a declaration of 'constrain' must be available [-fpermissive]
121 | else if ( constrain(mbdsr0, 16, 64) == 16 ) {
| ^~~~~~~~~
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4FD.tpp:125:13: warning: there are no arguments to 'constrain' that depend on a template parameter, so a declaration of 'constrain' must be available [-fpermissive]
125 | else if ( constrain(mbdsr0, 32, 64) == 32 ) {
| ^~~~~~~~~
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4FD.tpp:133:8: warning: there are no arguments to 'constrain' that depend on a template parameter, so a declaration of 'constrain' must be available [-fpermissive]
133 | if ( constrain(mbdsr1, 8, 64) == 8 ) {
| ^~~~~~~~~
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4FD.tpp:136:13: warning: there are no arguments to 'constrain' that depend on a template parameter, so a declaration of 'constrain' must be available [-fpermissive]
136 | else if ( constrain(mbdsr1, 16, 64) == 16 ) {
| ^~~~~~~~~
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4FD.tpp:140:13: warning: there are no arguments to 'constrain' that depend on a template parameter, so a declaration of 'constrain' must be available [-fpermissive]
140 | else if ( constrain(mbdsr1, 32, 64) == 32 ) {
| ^~~~~~~~~
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4FD.tpp: In member function 'void FlexCAN_T4FD<_bus, _rxSize, _txSize>::mailboxStatus()':
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4FD.tpp:810:53: error: 'HEX' was not declared in this scope; did you mean 'arduino::HEX'?
810 | Serial.print("(ID: 0x"); Serial.print(id, HEX); Serial.print(")");
| ^~~
| arduino::HEX
.pio\libdeps\teensy40\freertos-teensy\src/arduino_freertos.h:192:26: note: 'arduino::HEX' declared here
192 | static constexpr uint8_t HEX { 16 };
| ^~~
In file included from .pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4.h:565:
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4FDTimings.tpp: In member function 'bool FlexCAN_T4FD<_bus, _rxSize, _txSize>::setBaudRate(CANFD_timings_t, uint8_t, uint8_t, FLEXCAN_RXTX, bool)':
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4FDTimings.tpp:285:59: error: 'HEX' was not declared in this scope; did you mean 'arduino::HEX'?
285 | if ( advanced ) Serial.println(FLEXCANb_CTRL1(_bus),HEX);
| ^~~
| arduino::HEX
.pio\libdeps\teensy40\freertos-teensy\src/arduino_freertos.h:192:26: note: 'arduino::HEX' declared here
192 | static constexpr uint8_t HEX { 16 };
| ^~~
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4FDTimings.tpp:287:57: error: 'HEX' was not declared in this scope; did you mean 'arduino::HEX'?
287 | if ( advanced ) Serial.println(FLEXCANb_CBT(_bus),HEX);
| ^~~
| arduino::HEX
.pio\libdeps\teensy40\freertos-teensy\src/arduino_freertos.h:192:26: note: 'arduino::HEX' declared here
192 | static constexpr uint8_t HEX { 16 };
| ^~~
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4FDTimings.tpp:289:60: error: 'HEX' was not declared in this scope; did you mean 'arduino::HEX'?
289 | if ( advanced ) Serial.println(FLEXCANb_FDCBT(_bus) ,HEX);
| ^~~
| arduino::HEX
.pio\libdeps\teensy40\freertos-teensy\src/arduino_freertos.h:192:26: note: 'arduino::HEX' declared here
192 | static constexpr uint8_t HEX { 16 };
| ^~~
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4FDTimings.tpp:291:61: error: 'HEX' was not declared in this scope; did you mean 'arduino::HEX'?
291 | if ( advanced ) Serial.println(FLEXCANb_FDCTRL(_bus) ,HEX);
| ^~~
| arduino::HEX
.pio\libdeps\teensy40\freertos-teensy\src/arduino_freertos.h:192:26: note: 'arduino::HEX' declared here
192 | static constexpr uint8_t HEX { 16 };
| ^~~
src\main.cpp: In function 'void task1(void*)':
src\main.cpp:34:18: warning: unused parameter 'pvParameters' [-Wunused-parameter]
34 | void task1(void *pvParameters)
| ~~~~~~^~~~~~~~~~~~
src\main.cpp: In function 'void task2(void*)':
src\main.cpp:48:18: warning: unused parameter 'pvParameters' [-Wunused-parameter]
48 | void task2(void *pvParameters)
| ~~~~~~^~~~~~~~~~~~
src\main.cpp: In function 'void task3(void*)':
src\main.cpp:76:18: warning: unused parameter 'pvParameters' [-Wunused-parameter]
76 | void task3(void *pvParameters)
| ~~~~~~^~~~~~~~~~~~
Indexing .pio\build\teensy40\lib854\libSPI.a
Compiling .pio\build\teensy40\lib7eb\SdFat\FatLib\FatFileSFN.cpp.o
Compiling .pio\build\teensy40\lib7eb\SdFat\FatLib\FatFormatter.cpp.o
Compiling .pio\build\teensy40\lib7eb\SdFat\FatLib\FatName.cpp.o
Compiling .pio\build\teensy40\lib7eb\SdFat\FatLib\FatPartition.cpp.o
Compiling .pio\build\teensy40\lib7eb\SdFat\FatLib\FatVolume.cpp.o
Compiling .pio\build\teensy40\lib7eb\SdFat\FreeStack.cpp.o
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4.h: In instantiation of 'int FlexCAN_T4<_bus, _rxSize, _txSize>::write(const CANFD_message_t&) [with CAN_DEV_TABLE _bus = CAN2; FLEXCAN_RXQUEUE_TABLE _rxSize = RX_SIZE_256; FLEXCAN_TXQUEUE_TABLE _txSize = TX_SIZE_16; CANFD_message_t = CANFD_message_t]':
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4.h:484:9: required from here
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4.h:484:38: warning: unused parameter 'msg' [-Wunused-parameter]
484 | int write(const CANFD_message_t &msg) { return 0; } /* to satisfy base class for external pointers */
| ~~~~~~~~~~~~~~~~~~~~~~~^~~
Compiling .pio\build\teensy40\lib7eb\SdFat\FsLib\FsFile.cpp.o
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4.h: In instantiation of 'int FlexCAN_T4<_bus, _rxSize, _txSize>::write(const CANFD_message_t&) [with CAN_DEV_TABLE _bus = CAN1; FLEXCAN_RXQUEUE_TABLE _rxSize = RX_SIZE_256; FLEXCAN_TXQUEUE_TABLE _txSize = TX_SIZE_16; CANFD_message_t = CANFD_message_t]':
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4.h:484:9: required from here
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4.h:484:38: warning: unused parameter 'msg' [-Wunused-parameter]
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4FD.tpp: At global scope:
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4FD.tpp:402:13: warning: 'void flexcan_isr_can3fd()' defined but not used [-Wunused-function]
402 | static void flexcan_isr_can3fd() {
| ^~~~~~~~~~~~~~~~~~
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4.tpp:1127:13: warning: 'void flexcan_isr_can3()' defined but not used [-Wunused-function]
1127 | static void flexcan_isr_can3() {
| ^~~~~~~~~~~~~~~~
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4.tpp:1123:13: warning: 'void flexcan_isr_can2()' defined but not used [-Wunused-function]
1123 | static void flexcan_isr_can2() {
| ^~~~~~~~~~~~~~~~
.pio\libdeps\teensy40\FlexCAN_T4/FlexCAN_T4.tpp:1119:13: warning: 'void flexcan_isr_can1()' defined but not used [-Wunused-function]
1119 | static void flexcan_isr_can1() {
| ^~~~~~~~~~~~~~~~
Compiling .pio\build\teensy40\lib7eb\SdFat\FsLib\FsNew.cpp.o
*** [.pio\build\teensy40\src\main.cpp.o] Error 1
C:\Users\ADMIN\.platformio\packages\framework-arduinoteensy\libraries\SdFat\src\FatLib\FatFormatter.cpp: In function 'const uint8_t* initFatDirCallback(uint32_t, void*)':
C:\Users\ADMIN\.platformio\packages\framework-arduinoteensy\libraries\SdFat\src\FatLib\FatFormatter.cpp:90:52: warning: unused parameter 'sector' [-Wunused-parameter]
90 | static const uint8_t * initFatDirCallback(uint32_t sector, void *context) {
| ~~~~~~~~~^~~~~~
C:\Users\ADMIN\.platformio\packages\framework-arduinoteensy\libraries\SdFat\src\FatLib\FatPartition.cpp: In static member function 'static void FatPartition::freeClusterCount_cb_fat16(uint32_t, uint8_t*, void*)':
C:\Users\ADMIN\.platformio\packages\framework-arduinoteensy\libraries\SdFat\src\FatLib\FatPartition.cpp:337:55: warning: unused parameter 'sector' [-Wunused-parameter]
337 | void FatPartition::freeClusterCount_cb_fat16(uint32_t sector, uint8_t *buf, void *context) {
| ~~~~~~~~~^~~~~~
C:\Users\ADMIN\.platformio\packages\framework-arduinoteensy\libraries\SdFat\src\FatLib\FatPartition.cpp: In static member function 'static void FatPartition::freeClusterCount_cb_fat32(uint32_t, uint8_t*, void*)':
C:\Users\ADMIN\.platformio\packages\framework-arduinoteensy\libraries\SdFat\src\FatLib\FatPartition.cpp:350:55: warning: unused parameter 'sector' [-Wunused-parameter]
350 | void FatPartition::freeClusterCount_cb_fat32(uint32_t sector, uint8_t *buf, void *context) {
| ~~~~~~~~~^~~~~~
 
100 as task stack is probably not enough, especially if you use printf.
I read somewhere that printf is not reentrant. It means you should print on serial only on one task.

Angelo
 
I read somewhere that printf is not reentrant. It means you should print on serial only on one task.
printf is (as is any access to stdin or stdout) assuming the proper newlib hooks have been implemented (which they have). Serial.printf and other Serial member functions are completely different.
 
Thanks jmarsh, I completely missed the hooks implementation. Another good reason to use Timo Sandman implementation.
In my application, printf was only used in one task, for debug purpose.

Angelo
 
When I am connecting 2 can controllers with teensy board I am able to read and write data through can but when I am connecting can shield with Arduino and connecting to one of can controller then I am not able to read can messages which is connected to teensy board. What can be issue about that?
 
Check the connections, and there should be only two 120ohms resistors. One at each end of the bus

Angelo
 
This is hardware connection. can you suggest what need to do?
 

Attachments

  • IMG_20240424_142324-min.jpg
    IMG_20240424_142324-min.jpg
    263 KB · Views: 41
Are the two modules connected with USB on the same PC ??

What about software configuration: same bitrate, standard/extended ID, filters, message sent from/to arduino+canshield

Try with twisted pair cable, longer, about 1 meter.

Angelo
 
yes, both modules are connected with usb on same pc.

#include <mcp_can.h>
#include <SPI.h>
MCP_CAN CAN0(10); // Set CS to pin 10
void setup()
{
Serial.begin(9600);
// Initialize MCP2515 running at 16MHz with a baudrate of 250kb/s and the masks and filters disabled.
if (CAN0.begin(MCP_ANY, CAN_250KBPS, MCP_16MHZ) == CAN_OK) Serial.println("MCP2515 Initialized Successfully!");
else Serial.println("Error Initializing MCP2515...");
CAN0.setMode(MCP_NORMAL); // Change to normal mode to allow messages to be transmitted
}
byte data[8] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7D}; // Send a value of 125
void loop()
{
// send data: ID = 0x100, Standard CAN Frame, Data length = 8 bytes, 'data' = array of data bytes to send
byte sndStat = CAN0.sendMsgBuf(0xFF0122, 1, 8, data);
if (sndStat == CAN_OK) {
Serial.println("Message Sent Successfully!");
} else {
Serial.println("Error Sending Message...");
}
delay(1000); // send data per 1000ms
}
this code I am flashing on Arduino with mcp2515 can controller and trying to read on another can controller which is connected to teensy board.
 
No, that is extended id format and for that second parameter is one from Arduino I am getting message sent successfully.
but in teensy I am not able to read through can
 
My one can is connected to pin number 23,22 and second one 0,1 so in code which one will be can 1 and can2?
 
Back
Top