n3rd4n1 / ccdbg

A bit-bang implementation of the protocol used by CC Debugger.
MIT License
10 stars 2 forks source link

Adapting for use with the Raspberry Pi 3 B #2

Open mcummings1 opened 7 years ago

mcummings1 commented 7 years ago

Hello,

I'm trying to adapt this code to work on the Raspberry Pi 3. I don't think it really needs anything changed except the way the GPIO pins are set within the ccdbg-rpi.cpp file. I'm not familiar with the earlier versions of the Pi and I think that's probably what's throwing me off.

Can you tell me exactly how the following lines point to actual GPIO lines?

define RESET 11 // GPIO4, pin 7

define DC 23 // GPIO0, pin 3

define DD 24 // GPIO1, pin 5

I guess I could look back at the previous versions of the Pi and figure out how 11, 23 and 24 mapped to GPIO4, pin7, GPIO0, pin 3, and GPIO1, pin 5, but I'm not sure that's the best way to proceed! Anyway, any help you might be able to provide me would be greatly appreciated.

Thanks, Marshall

idoodler commented 7 years ago

Hi,

you basically can use any GPIO Pin you like, just define it in ccdbg-rpi.cpp. You can find the GPIO Pinout here.

Hope that helps.

mcummings1 commented 7 years ago

Thanks for that! Actually, I did finally get back to this project recently and discovered that the assignments were in that file and are nothing more than the BCM number. Anyway, I set everything up and tried it out, but am unable to recognize the module as of yet. I use a BLE112 breakout board with the following connections;

P2_1 - GP18 (RPi 3, pin 12) P2_2 - GP13 (RPi 3, pin 33) RES - GP12 (RPi 3, pin 32)

and then the following lines in ccdbg-rpi.cpp;

define RESET 12

define DC 13

define DD 18

When I run the software (sudo ./ccdbg -si), I get

FAILED to identify the chip

I have yet to hook up my scope to those three pins and take a look at what's really going on, but I thought I might as well describe what I've seen so far. If I understand things correctly, there should be no need for any external components (i.e., no pull up resisters, no pull down resistors, no level matching components since the RPi is talking 3.3v already...).

Any thoughts?

Thanks, Marshall

idoodler commented 7 years ago

I have had a similar problem with my setup. I was using it with an Intel Edison (1.8V Logic), the chip could not be identified as well. I then noticed, that the other board was using 3.3V Logic. I am now using level shifter and everything works fine.

mcummings1 commented 7 years ago

Actually, I had that problem when I did a similar project using the Arduino to program the BLE112. Take a look here for details

http://magictale.com/2884/flashing-ble112-with-arduino-based-cc-debugger/

The problem turned out to be that the simple voltage divider circuit that Dmitry described in his article had never actually been tried! I replaced it with a true voltage divider circuit and all was well.

But here, I’m using a Raspberry Pi 3 which is a 3.3v interface on all GPIO pins, that’s what has me so confused. Anyway, I still really need to sit down with an oscilloscope and see what sort of signals I’m seeing at the BLE112. Once I do that, I will post my results.

Really knew what was preventing this from working properly!

Marshall