PicKIT4/MPLABX direct connection to Cyton / Debugging & Exploration

edited May 2020 in Cyton

Dear forum,
first of all thanks for your work so far in democratising this key technology. I have a few questions regarding exploration of the board.

I received my CytonDaisy board end of last year and plan to use it in an FFR response analysis on the auditory nerve. I have the board successfully working with the GUI after having had to reprogram both rfduino modules (dongle and on-board) for some reason - but all is working now.

---- EDIT: After rereading this post (https://openbci.com/forum/index.php?p=/discussion/208/chipkit-uploading-tips-restarting-bootloader/p4) I tried it and the connection works, I can read target memory. ----

My question: I want to connect (optimally) directly from my Pickit4 to the cyton board to dive deeper into using additional resources of the powerful PIC (for directly triggered DDS stimulus for example). I have read several topics on this but am a bit confused as to the correct pin-connection. After reading I concluded on this pinout:
pickit4 -> cyton
1 MCLR/VPP -> J4.RST
2 VDD -> J3.Vdd
3 VSS -> J3.GND
4 PGD -> J4.D11
5 PGC -> J3.D12
6,7,8 -> unconnected
However, looking at the schematic, I see that on J4.D11, there's a diode and a resistor, which seems to interfere with Pickit's recommendations (Target Circuit Design Precautions - http://ww1.microchip.com/downloads/en/devicedoc/50002721a.pdf). Also, the OpenBCI documentation has me a bit confused on the correct pinout since D11 and D12 are listed as unused pins under the title Breakout pins (https://docs.openbci.com/docs/02Cyton/CytonSpecs) while below I read this: "D11 is also PGD, and has the blue LED in series with a 1K resistor connected to AGND. D12 is PGC, for bootloading purposes."

What is your opinion on the pinout? I am being probably overly cautious here not to make a mistake but it'd be great to hear you on this strategy.
Many thanks,
Max

Comments

  • wjcroftwjcroft Mount Shasta, CA

    Max, hi.

    Can you clarify? What is your goal in connecting the Pickit4 to the Cyton? The Cyton already has a bootloader installed that will let you install new PIC firmware from the Arduino IDE:

    https://docs.openbci.com/docs/02Cyton/CytonProgram

    So there is no need to use the Pickit4 to program the PIC. At the factory the Pickit IS used to install the initial bootloader. But after that is done, all new Cyton firmware can be installed over the RFduino radio link.

    Regards, William

  • wjcroftwjcroft Mount Shasta, CA

    I guess you might be interested in the "in-circuit debugging" capability of the MPLAB system. But really, you have an extra serial port on the Cyton PIC, that can be used for output and input; which is both no-cost, and probably MORE functional than single stepping / breakpoints in PIC assembler code. The two serial ports on the Cyton (in Arduino functions) are serial0 and serial1. The '0' port is directly connected to the RFduino and used for the radio link. The '1' port can be used for your debugging output / input.

  • Hi,
    sorry for not replying earlier and thank you already for the info. My first goal was to change the workflow, meaning that I would like to work in MPLABX because of its ease of use, and because of the depth I can go into, like you mention it, in-circuit-debugging and looking at registers at different points, not necessarily stepping through but having those possibilities to increase my productivity while exploring. However, I have no luck in getting this to work as I remain with a number of compile errors in MPLABX when I try to compile the defaultboard from there, I don't know if I should spend the time to set this up with the conflicts between the xc32 compiler and the libraries included and not included. Additionally, both the Arduino and the Chipkit import plugin for MPLABX don't work with my version of MPLABX. This would be my perfect setup.

    Secondly, yes I see the serial1 through the uart connection, however that would leave me with the only option to do Serial.println readouts on the serial monitor, which I find rather limited, or do I miss something?

    Finally, also concerning workflow, it is cumbersome to upload new sketches through rflink because I have to upload the pass-through sketch, to the dongle, push the switch and backwards if I want to have a quick check with the GUI or with another acquisition server.

  • wjcroftwjcroft Mount Shasta, CA

    re: "pass-through". That only is used if you are programming the RFduino on the Cyton mainboard. Neither RFduino dongle nor RFduino mainboard needs to be reprogrammed, once they have the current firmware.

    https://docs.openbci.com/docs/02Cyton/CytonProgram

    re: "only option to do Serial.println". You should be able to BOTH do serial1 output AND serial1 input, by checking to see that serial1 has an input character waiting.

    re: in-circuit debugging. Another downside to that approach, would be that the entire Arduino sketch on the mainboard, is intended to run in real-time, with all the data-flows it is managing. Any debugging system that stops that flow processing, will have an unrealistic picture of what is going on.

    Regards, William

Sign In or Register to comment.