How to upload code to BlueSaab (SAAB-CDC) module using Xcode on a Mac

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

How to upload code to BlueSaab (SAAB-CDC) module using Xcode on a Mac

Karlis
Administrator
Here's how to upload the code using Xcode on a Mac

Background

    *) BlueSaab module is based on Arduino framework
    *) There are three main components:
        - Main ATMEGA328P-PU chip that controls the whole lot.
        - MCP2515 chip: controls “conversations” between the car and BlueSaab module.
        - RN52 bluetooth module: controls the communications between BlueSaab module and audio source.
        - ATMEGA328P-PU controls everything. RN52 and MCP2515 are not aware of each others existence. They just don’t care…

Pre-requisites

    *) A Mac running OSX 10.9 (or later).
    *) Xcode version 7.2 or later.
    *) Latest version of Arduino IDE (at the time of this post it is 1.6.9). Download and install it.
    *) Latest version of embedXcode plugin (at the time of this post it is 451). Download and install it.
    *) An USB->FTDI cable.

Prepare for the code upload

    1. Open Xcode.
    2. Click on "Check out an existing project" from the first screen.
        -) You will need to do this only once as the next step will download the code from Github and keep it on your machine.
    3. Enter this link in "Or enter a repository location:" field and click "Next".
    4. Select 'master' from the list of branches and click "Next".
    5. Choose a location on your Mac where you want to keep a copy of the project files.
    5. Now a copy of the code will be downloaded to your machine and is ready for use.

Working with code

    *) There are two options for building the code in Xcode: "All" and "Build".
        - When "All" is selected, Xcode will compile the code and will attempt to upload the code to the ATMEGA328P-PU. If there's no connection to the chip, the build will fail.
        - When "Build" is selected, Xcode will compile the code 'locally' and won't upload it to ATMEGA328P-PU chip. This comes really handy when you want to do some coding or debugging.

    *) To upload the code to the BlueSaab module, connect it to the Mac via USB->FTDI cable, select "All" option and press the "Play" button on top left corner. This will start the build process.
    *) After a successful build, a message "Build Succeeded" will be shown and a Terminal app window will automatically pop up giving you a direct access to serial console output.
2001 9-5 SE V6; 2006 9-5 Wagon; iOS; BlueSaab version = "latest and greatest" :)