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 , https://os.mbed.com/users/WiredHome/notebook/can---getting-started/ 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
", 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()
");
counter++;
printf("Message sent: %d
", 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 ?
question from:
https://stackoverflow.com/questions/65920457/can-bus-stm32-nucleo-f429zi-can-write-fail 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…