Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
7 years, 3 months ago.
I2c Touchscreen vs CAN1 problem
Touchscreen and CAN not compatible. Actually in this board there is only one usable CAN (CAN1), but the pin are used by the I2C for the touchscreen. Can you please allow the use of the second CAN on the connector cn12 please.
Question relating to:
1 Answer
7 years, 3 months ago.
Hello, I agree with your request. We will add those missing pins soon.
Thank you for your remark. Kind regards
Pull request is posted in mbed (https://github.com/ARMmbed/mbed-os/pull/3369), you will be able to have this code available once it will be merged.
posted by 05 Dec 2016There is a problem the can2(PB_5,PB_13) works only if you declare first the can1(PB_8,PB_9). And unfortunately Can1(PB_8,PB_9) is used by the touchscreen I2C. Is it possible to resolve this bug?
- include "mbed.h"
void canRx_ISR (void);
Ticker ticker; DigitalOut led1(LED1); DigitalOut led2(LED2); CAN can1(PB_8, PB_9); CAN can2(PB_5, PB_13); char counter = 0;
CANMessage trame_Tx;
void send() { printf("send()\n"); if(can2.write(trame_Tx)) { printf("wloop()\n"); counter++; printf("Message sent: %d\n", counter); } led1 = !led1; }
int main() { printf("main()\n"); can2.frequency(1000000); fréquence de travail 1Mbit/s trame_Tx.id = 0x603; trame_Tx.len = 1; trame_Tx.format = CANStandard; trame_Tx.type = CANData; trame_Tx.data[0] = 0x1;
ticker.attach(&send, 1); CANMessage msg; while(1) { printf("loop()\n"); if(can2.read(msg)) { printf("Message received: %d\n", msg.data); } wait(0.2); } }
comment can1 on the code and the network don't work (message is sent but is whatever)
posted by 28 Feb 2017