Open GiovanniRaseraF opened 1 year ago
hi @MehmetAliAksoy1 please post the code you think is important here, so we can try to help you :)
i only added two lines to your example code. The reason I added was to make mcp's cs pin HIGH and cut off communication, gps' cs pin to LOW and open it to communication. When i add this like that, on serial monitor SPI_FLASH_BOOT_MODE writing repeatedly
Actually i want to select cs pin and take data from gps and spi
how can i add gps's spi pin to same spi channel? please help @GiovanniRaseraF
Check some things:
#define MISO 19
#define MOSI 23
#define SCK 18
#define SS 5
Pins are correct, but i want to select CS pin when i use
Okay, please try all the things and report your findings. And please provide the name of the gps that you are using.
void spi_read(char* data) { digitalWrite(GPS_CS, LOW); delay(10); for (int i = 0; i < 100; i++) { data[i] = SPI.transfer(0x00); } digitalWrite(GPS_CS, HIGH); }
void setup() { Serial.begin(9600); SPI.begin(14, 12, 13, 26); //sck, miso, mosi, ss pinMode(GPS_CS, OUTPUT); digitalWrite(GPS_CS, HIGH); }
void loop() { char gps_data[100]; spi_read(gps_data); Serial.println(gps_data); delay(1000); }
This gps code working and print datas. Gps module is Neo-m8.
When I combine this code with the CAN code, I cannot receive data from GPS. Even when I turn the MCP's CS pin high, data starts coming directly from the can.
When i call SPI.begin() after The canbus integration at Setup, it is working, why? @GiovanniRaseraF
I think the problem is that you are using SPI in the wrong way, i cannot test it so i cannot be sure. And i think that Neo-m8 uses I2C at 9600 baud.
The best thing i can tell you is to:
And at the end post the code in you git and link it here or post it here with a markdown tag; it will be easier to read
No, we made connection with both of them on HSPI. But gps's select pin 26. I can not use i2c
And also your code does not work for me now
I solved the problem but i did not any connection to mcp2515 from read the data. But on the serial monitor: ID: 447 DATA: ID: 42C DATA: ID: 50A DATA: ID: 12E DATA: ID: 341. What is this data came from? How is it possible? @GiovanniRaseraF
There is no change when SS pin select another free pin.
I solved the problem but i did not any connection to mcp2515 from read the data. But on the serial monitor: ID: 447 DATA: ID: 42C DATA: ID: 50A DATA: ID: 12E DATA: ID: 341. What is this data came from? How is it possible? @GiovanniRaseraF
Could you show me your code for can bus?
At the same time, when I run the code without making any connections, the DATA part is empty and the ID part is written. Is it normal? I'll be glad, if you help me
Originally posted by @MehmetAliAksoy1 in https://github.com/dedalqq/esp32-mcp2515/issues/4#issuecomment-1454732263