Jump to content
43oh

Is it Better to Change Header or Remap GPIO in my Sketch?


Recommended Posts

Hello, everyone!

Don't know if @Rei Vilo or @energia would like to make a suggestion, but I hope so! :)

I'm working on a project using the CC3200Mod. The PCB should be ready later this week and I'd like to give the designer a basic firmware file to test it. This was no problem on the launchpad, but after we went over the schematic, we found that the pin layout is very different between the CC3200 and the CC3200Mod. 

Working with launchpads doesn't make a difference, but the PCB doesn't have those ports available, everything is connected to the pin on the chip.

Will I be better off by modifying my pin_energia.h file to represent the CC32000MOD's layout or should I map the individual GPIOs in my sketch?

Current pin_energia.h (matches CC32000 pin out):

const uint16_t digital_pin_to_pin_num[] = {
    NOT_A_PIN,    /*  dummy */
    NOT_A_PIN,    /*  1  - 3.3V */
    PIN_58,        /*  2  - GPIO_03 */
    PIN_04,        /*  3  - GPIO_13 */
    PIN_03,        /*  4  - GPIO_12 */
    PIN_61,        /*  5  - GPIO_06 */
    PIN_59,        /*  6  - GPIO_04 */
    PIN_05,        /*  7  - GPIO_14 */
    PIN_62,        /*  8  - GPIO_07 */
    PIN_01,        /*  9  - GPIO_10 */
    PIN_02,        /*  10 - GPIO_11 */
    PIN_15,        /*  11 - GPIO_22 */
    PIN_55,        /*  12 - GPIO_01 */
    PIN_21,        /*  13 - GPIO_25 */
    PIN_06,        /*  14 - GPIO_15 */   
    PIN_07,        /*  15 - GPIO_16 */   
    NOT_A_PIN,    /*  16 - RESET */
    PIN_45,        /*  17 - GPIO_31 */
    PIN_08,        /*  18 - GPIO_17 */    
    PIN_18,        /*  19 - GPIO_28 */
    NOT_A_PIN,    /*  20 - GND */
    NOT_A_PIN,    /*  21 - 5V */
    NOT_A_PIN,    /*  22 - GND */
    PIN_57,        /*  23 - GPIO_02 */
    PIN_60,        /*  24 - GPIO_05 */
    PIN_58,        /*  25 - GPIO_03 */
    PIN_59,        /*  26 - GPIO_04 */
    PIN_63,        /*  27 - GPIO_08 */
    PIN_53,        /*  28 - GPIO_30 */
    PIN_64,        /*  29 - GPIO_09 */
    PIN_50,        /*  30 - GPIO_00 */
    PIN_17,        /*  31 - GPIO_24 */
    PIN_16,        /*  32 - GPIO_23 */
    PIN_60,        /*  33 - GPIO_05 */
    PIN_62,        /*  34 - GPIO_07 */
    PIN_18,        /*  35 - GPIO_28 */
    PIN_21,        /*  36 - GPIO_25 */
    PIN_64,        /*  37 - GPIO_09 */
    PIN_17,        /*  38 - GPIO_24 */
    PIN_01,        /*  39 - GPIO_10 */
    PIN_02        /*  40 - GPIO_11 */
};

CC3200 pinout:
http://www.ti.com/ods/images/SWAS032F/po_DEV3200_swas032.gif

CC3200MOD pinout:

http://www.ti.com/ods/images/SWRS166/CC3200MOD_Pin_Diagram.gif

Any thoughts or opinions would be very welcome!

Link to post
Share on other sites

I would suggest to create your own variant in the variant directory. Then add that variant to board.txt which will make it available in the Energia boards menu.

Be carful with directly modifying the core. If you install a core update through the board manager, you will loose all your modifications. A better way but more complex would be to create your own installable light weight package. Here is an example of a lightweight TivaC package that I put together a while ago. The downside is that you will have to be able to host the .json file somewhere so that you can point Energia to it in the preferences->Additional Boards Manager URLs.

http://energia.nu/packages/package_wrigley_index.json

Robert

Link to post
Share on other sites

@energia

Thank you, Robert!

Since this is a variant of the CC3200, I assume I'll add it to:

C:\Users\username\AppData\Local\Energia15\packages\energia\hardware\cc3200\1.0.2\variants\

That should give me a quick stop-gap for making test firmware for the new PCB.

Making a lightweight package is probably the way I'll go, and hosting will not be a problem, I just have to puzzle out what I'm doing :)

I really appreciate the advice!

Link to post
Share on other sites
  • 5 months later...
On 7/18/2017 at 12:16 PM, energia said:

I would suggest to create your own variant in the variant directory. Then add that variant to board.txt which will make it available in the Energia boards menu.

Be carful with directly modifying the core. If you install a core update through the board manager, you will loose all your modifications. A better way but more complex would be to create your own installable light weight package. Here is an example of a lightweight TivaC package that I put together a while ago. The downside is that you will have to be able to host the .json file somewhere so that you can point Energia to it in the preferences->Additional Boards Manager URLs.

http://energia.nu/packages/package_wrigley_index.json

Robert

@energia

Happy New Year, Robert!

I've been on quite a roller coaster getting my board ready, but it is finally finished and I can focus on my firmware.

Could you possibly give me some guidance on what I actually need to do to create a light weight package?

I can extract and duplicate my own version of each file in each archive if needed, but are there any components that I don't need to reproduce? Is there any other guidance you can share to give me some direction?

Thanks
Doug

Link to post
Share on other sites

I missed this when I answered the Pm yesterday!

There are 10 GPIOs (1 ADC, 1 PWM, 2 UART)

GPIO  0    PIN 44    ADC - EN   (voltage measurement)
GPIO  1    PIN 46    TX (UART)
GPIO  2    PIN 47    RX (UART)
GPIO  4    PIN 49    VMEAS_BAT  (voltage measurement)
GPIO  5    PIN 50    ADC - DRV5053 - omnidirectional Hall sensor
GPIO 10    PIN 3     PWM - Piezo
GPIO 12    PIN 9     LED
GPIO 13    PIN 10    DRV5032 bi-directional Hall sensor 
GPIO 14    PIN 5     LED
GPIO 28    PIN 19    LED

Is that too many to remap an existing board?

Link to post
Share on other sites

It is not that hard really. You  might be over thinking it. You might have quite a bit more challenging if moving away from Energia especially with WiFi.

I can put a Skeleton package together tomorrow to show you how easy it is to create a custom lightweight package based on the core package. It will be the same as the other example I linked to in an earlier post. Please let me know if you are interested. Otherwise good luck with CCS/Driverlib/etc.

Robert

Link to post
Share on other sites
1 hour ago, energia said:

It is not that hard really. You  might be over thinking it. You might have quite a bit more challenging if moving away from Energia especially with WiFi.

I can put a Skeleton package together tomorrow to show you how easy it is to create a custom lightweight package based on the core package. It will be the same as the other example I linked to in an earlier post. Please let me know if you are interested. Otherwise good luck with CCS/Driverlib/etc.

Robert

There is always a VERY good chance I am overthinking things. 

If you've got time to do it and don't mind, I'll really appreciate it.

Also, my board doesn't have a USB connection - I use the Launchpad to flash the board to upload the bin I create in Energia using Uniflash (also can run example programs in debug mode in CCS using JTAG). 

Does that affect the use of a lightweight package?

Link to post
Share on other sites

Attached is a lightweight package. Unzip and place in <Sketch Folder>/hardware/. If the hardware folder does not exist, create it. If you do not know the location of your Sketch folder, go into Energia->Preferences and it is listed under "Sketchbook location" Your directory structure should now look like the below. You can now edit pins_energia.h to match that of your board.

hardware/
└── xeebot
    └── cc3200
        ├── boards.txt
        ├── platform.txt
        └── variants
            └── XEEBOT
                ├── part.h
                └── pins_energia.h

 

xeebot.zip

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...