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.
9 years, 6 months ago.
How to create instance of CAN3?
I have a mbed LPC1768 connected to an MCP2515. My ultimate goal is to add a third CAN channel to the 2 existing channels on the LPC chip. I have included your files in my project, but when I construct and instance of the CAN3 class, all 4 LEDs on the mbed start flashing which doesn't make sense to me. Any idea what im doing wrong? Code below:
- include "mbed.h"
- include "CAN3.h"
DigitalOut myled(LED1); CAN can1(P0_0, P0_1); CAN can2(P0_4, P0_5); SPI spi(P0_9, P0_8, P0_7); CAN3 can3(spi, P0_6, P1_31);
int main() { while(1) { myled = 1; } }
Question relating to:
1 Answer
9 years, 6 months ago.
You will also get a message on your serial terminal which should give you more information. In general this means you are trying to use peripherals for a pin which is not supported. For example your SPI on non-SPI pins. However quick check shows that to be correct.
What is a problem however is P1_31: It is used as InterruptIn, and on the LPC1768 this is only allowed on port 0 and port 2. So move it to a pin on one of those two ports and it should work.