CAN BUS STM32 Nucleo F429ZI CAN Write Fail

kantrveysel
Wed, 27 Jan 2021 13:31:23 +0000
Mbed OS

Hi,
It is Veysel My board is STM32 Nucleo F429ZI and I use Mbed-os 6.6.0. I can read from my car CANBus data but I am not able to write on the bus. I tried it with two STM32 (same boards) and my trancivers are SN65HVD230
So I know that I can read on the CANBus , but I cannot write.

I have tried , CAN - Getting Started | Mbed with one STM32 and I have tried

#include "mbed.h"

//Ticker ticker;
DigitalOut led1(LED1);
DigitalOut led2(LED2);
//CAN can1(PD_0, PD_1);
CAN can2(PB_8, PB_9);
DigitalOut led3(LED3);


char counter = 0;

void messageReceivedISR() {
 CANMessage msg;
 if(can2.read(msg)) {
        printf("Message received: %d, from %d\r\n", msg.data[0], msg.id);
        if(msg.id == 1100)
            led2 = !led2;
        if(msg.id == 1102)
            led3 = !led3;
}


}

int main() {


can2.frequency(1000000);
can2.reset();
can2.attach(&messageReceivedISR, CAN::RxIrq);
while(1) {
    if(can2.write(CANMessage(1130, &counter, 1))) {
        printf("loop send()\r\n");
        counter++;
        printf("Message sent: %d\r\n", counter);
        led1 = !led1;
    }

   // wait_ms(500);
}
}

I switch writing address for both stm32
This is fulling mailbox three times and stop. None read.

I have tried directly connect with one jumper from Crx to Ctx but nothing changes.

I also tried it with STM32 to Teensy ( Teensy is controing my cars LED Screen it can also read ) , but failed.

Please Help ?

12 posts - 3 participants