Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arduino Due not connecting to CH376 #55

Closed
sidprice opened this issue Sep 13, 2021 · 9 comments
Closed

Arduino Due not connecting to CH376 #55

sidprice opened this issue Sep 13, 2021 · 9 comments

Comments

@sidprice
Copy link

Hello, I have the CH376S module and I have installed this library. My board is an Arduino Due and I have followed the wiring diagram on this repo. However,my Arduino Due is not able to communicate with the module.

I have done some debugging I I find the library stays in the loop shown below in the "CheckIntMessage" function:

	} else {//spi
		while(!digitalRead(_intPin)){
			tmpReturn = getInterrupt(); // get int message
			delay(10);//sadly but it required for stability, sometime prior attaching drive the CH376 produce more interrupts
		}// end while
	}//end if interface

The library is initialized with:
Ch376msc flashDrive(10); // chipSelect

Advice on getting this working would be much appreciated.

@djuseeq
Copy link
Owner

djuseeq commented Sep 15, 2021

Hi. I know about it, i have tested and in SPI mode works just with using an extra pin (interrupt). Use Ch376msc flashDrive(10, 9); // chipSelect, interrupt pin instead.

@sidprice
Copy link
Author

Thank you I was able to get it to work using the interrupt input. However, I need to have multiple SPI devices on the bus so I do not think I can use this method.

Do you know if the CH376 works if not using the INT input?

Many thanks for the help :)

@sidprice
Copy link
Author

sidprice commented Sep 15, 2021

Seems I spoke too soon. While the menu appears on the serial monitor (basicUsageSPI sketch) the CH376 does not access the flash drive. It just asks for a drive to be connected.

Note: I did format the flash drive with Active@ Partition Manager.

@sidprice
Copy link
Author

I am still unable to access my flash drive. I have hooked up the INT input as you sugegsted and also I have formatted the drive with Active@ Partition Manager.

I would appreciate some help in getting this to work.

@djuseeq
Copy link
Owner

djuseeq commented Sep 22, 2021

Thank you I was able to get it to work using the interrupt input. However, I need to have multiple SPI devices on the bus so I do not think I can use this method.

Do you know if the CH376 works if not using the INT input?

Many thanks for the help :)

Yes, this is the only option if you plan to attach multiple devices to the SPI bus. MISO, MOSI, SCK signals are shared between devices, every device has his own CS line and CH376 requires plus an extra pin for INT signal.

@djuseeq
Copy link
Owner

djuseeq commented Sep 22, 2021

Check that the communication between the DUE and the module is correct, use getChipVer(); method to query the program version. What value did you get?

@trotterlg
Copy link

I have used a solution to this issue that works well for me. I use two logic level shifting boards that have an enable pin on them. Tie one side together and use the remaking two sides to go to your devices. Then just enable the one you want with it enable pin while disabling the other.

@trotterlg
Copy link

749F0577-86DE-4CF3-B97E-0EEC306922B4

@sidprice
Copy link
Author

Many thanks for the suggestions and help. The issue was the hardware configuration, the module documentation and the chip datasheet are difficult to understand. After digging out my USB to SPI monitor (SPIDriver) and just try lots of simple Python tests I was able to discover the correct hookup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants