Skip to content

Commit

Permalink
v1.1 release.
Browse files Browse the repository at this point in the history
  • Loading branch information
CedricB31 committed Oct 16, 2023
1 parent 7407c12 commit cee7910
Show file tree
Hide file tree
Showing 12 changed files with 304 additions and 82 deletions.
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
*.bin
*.CV
*.OBJ
*.LST
*.MAP
*.list
*.MTP
*.DBG
*.TSK
*.ASM
lcd.pjw
.pjw
output/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "middleware/sigfox/sigfox-ep-lib"]
path = middleware/sigfox/sigfox-ep-lib
url = [email protected]:sigfox-tech-radio/sigfox-ep-lib.git
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [v1.1](https://github.com/sigfox-tech-radio/sigfox-ep-example-holtek-bc68f2150/releases/tag/v1.1) - 16 Oct 2023

### Changed

* Improve **spectrum template** with new amplitude profile tables.
* Add **ERROR_CODES** return.

### Fixed

* Fix exection issues with new IDE version **HT-IDE3000 V8.1.5** .
* Fix All uplink library feature can be embedded on the Soc but it is strongly recommended to use the **optimization flags** according to targetted the application in order to limit the memory footprint.

### Known limitations

* **600 bps** not compliant with 1.7 EP-SPECS.

## [v1.0](https://github.com/sigfox-tech-radio/sigfox-ep-example-holtek-bc68f2150/releases/tag/v1.0) - 02 Jun 2023

### General
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
## Description

This repository shows an example of Sigfox End-Point Library integraton on a HOLTEK low cost transmiter with flash MCU. It uses the code optimization features of the EP-LIB in order to minimize the memory footprint inside the MCU.
To have more informations about this design please refer to [wiki documentation](https://github.com/sigfox-tech-radio/sigfox-ep-example-holtek-bc68f2150/wiki).

## Architecture

This repository contains several source code and project files needed to compile the project. Only the source code files of the EP_LIB are not be included inside this repository: the EP_LIB project is a submodule and must be updated before to upload sources files in `middleware/sigfox/sigfox-ep-lib` folder.
This repository contains several source code and project files needed to compile the Low Cost Device (LCD) project. Only the source code files of the EP_LIB are not be included inside this repository: the EP_LIB project is a submodule and must be updated before to upload sources files in `middleware/sigfox/sigfox-ep-lib` folder.

```
. # Root directory
Expand Down Expand Up @@ -43,9 +44,11 @@ This repository contains several source code and project files needed to compile
The following figure shows the hardware architecture of the Holtek BC68F2150 board.

<p align="center">
<img src="docs/images/holtek_bc68f2150_architecture.png" width="600"/>
<img src="https://github.com/sigfox-tech-radio/sigfox-ep-example-holtek-bc68f2150/wiki/images/holtek_bc68f2150_architecture.drawio.png" width="600"/>
</p>

All gerbers and schematics are available in the wiki of this repository.

## Getting Started

### Cloning the repository and submodule
Expand Down
Binary file modified lcd.pjt
Binary file not shown.
2 changes: 1 addition & 1 deletion lcd.pjtx
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<HTIDE><CHTIdeProject g_wProjectVersion="20" m_sProjectDirectory="Z:\tmp\lcd" m_sProjectName="lcd" m_bDefault="0" m_sOutputDir=".\output\" m_sTargetChip="BC68F2150" m_nBuildMode="0" m_bListFile="1" m_bGenDisassembly="1" m_bMapFile="1" m_bStandAlone="0" m_bCodFile="0" m_bUseBootLoader="0" m_nBootLoaderMode="0" m_bOtpFile="1" m_bEnterDebugModeAfterBuild="1" m_dwOID="15598078" m_nSteppingCmd="0" m_wFIFOSize="0" m_byteBLID="0" m_strUserBCLPath="" m_bUseHoltekID="1" m_wCustomVID="0" m_wCustomPID="0" m_nEmulatedISPType="-1" m_CompilerFlagString=" -Wall -Os -fshort-enums" m_LinkFlagString="/OptimizeParam=16 /compact_rom /Stack /LInsVarOpt" m_AssemblerFlagString="" m_bCustomUsage="0" m_wUsagePage="65280" m_wUsage="32" m_bPartialLock="0" m_strPartialLockLib="" m_bIdCode_CheckBox="0" m_sIdCode_Edit="" m_strEntryFun="" m_bParseEntryFun="0" m_strGUID="" m_bCodeConfig="0" m_bTraceFields0="0" m_bTraceFields1="0" m_bTraceFields2="1" m_bTraceFields3="0" m_bTraceFields4="0" m_bTraceFields5="0" m_bTraceFields6="0" m_bTraceFields7="0" m_bTraceFields8="0" m_bTraceFields9="0" m_bDisplayVariableValue="1" m_nCrossToolVendor="3" m_bDisplayHexValue="0" m_bDisplayHexValueReg="0" m_bDetectStackOverflow="1" m_bDownLoadEEPROM="0" m_bRunToMainAfterBuild="1" m_CurLibType="8"><CBreakpoint m_nOCDSBreak="105" Count="0"/><m_listOfLib Count="0"/><m_SystemLibArr Count="2"><_0 Value="LIBHOLTEKGCC.LIB" StartAddr="-1" EndAddr="-1"/><_1 Value="v3_lmrsc.lib" StartAddr="-1" EndAddr="-1"/></m_SystemLibArr><m_listOfSecAddr Count="0"/><m_listOfSources Count="12"><_0 Value=".\startup1_l.asm" Attribute="0" StartAddr="-1" EndAddr="-1"/><_1 Value=".\main.c" Attribute="0" StartAddr="-1" EndAddr="-1"/><_2 Value=".\middleware\sigfox\manuf\mcu_api.c" Attribute="0" StartAddr="-1" EndAddr="-1"/><_3 Value=".\middleware\sigfox\manuf\mcu_rf_api_rodata.c" Attribute="0" StartAddr="-1" EndAddr="-1"/><_4 Value=".\middleware\sigfox\manuf\rf_api.c" Attribute="0" StartAddr="-1" EndAddr="-1"/><_5 Value=".\middleware\sigfox\manuf\TI_aes_128_encr_only.c" Attribute="0" StartAddr="-1" EndAddr="-1"/><_6 Value=".\middleware\sigfox\sigfox-ep-lib\src\sigfox_ep_api.c" Attribute="0" StartAddr="-1" EndAddr="-1"/><_7 Value=".\middleware\sigfox\sigfox-ep-lib\src\sigfox_error.c" Attribute="0" StartAddr="-1" EndAddr="-1"/><_8 Value=".\middleware\sigfox\sigfox-ep-lib\src\core\sigfox_crc.c" Attribute="0" StartAddr="-1" EndAddr="-1"/><_9 Value=".\middleware\sigfox\sigfox-ep-lib\src\core\sigfox_ep_bitstream.c" Attribute="0" StartAddr="-1" EndAddr="-1"/><_10 Value=".\middleware\sigfox\sigfox-ep-lib\src\core\sigfox_ep_frequency.c" Attribute="0" StartAddr="-1" EndAddr="-1"/><_11 Value=".\drivers\src\iap.c" Attribute="0" StartAddr="-1" EndAddr="-1"/></m_listOfSources><m_listOfSymDef Count="9"><_0 Value="__V3__"/><_1 Value="Disable_Bit_Initial"/><_2 Value="RC1"/><_3 Value="APPLICATION_MESSAGES"/><_4 Value="UL_BIT_RATE_BPS=100"/><_5 Value="TX_POWER_DBM_EIRP=13"/><_6 Value="T_IFU_MS=500"/><_7 Value="UL_PAYLOAD_SIZE=1"/><_8 Value="MESSAGE_COUNTER_ROLLOVER=4096"/></m_listOfSymDef><m_DocBook Count="0"/><m_PrjFolder Count="0"/><m_RamMonList Count="4"><_0 AddrFrom="-1" AddrTo="-1" bEnable="0"/><_1 AddrFrom="-1" AddrTo="-1" bEnable="0"/><_2 AddrFrom="-1" AddrTo="-1" bEnable="0"/><_3 AddrFrom="-1" AddrTo="-1" bEnable="0"/></m_RamMonList><CWatchVarList Count="4"><_0 Key="Watch1"><_0 Count="0"/></_0><_1 Key="Watch2"><_1 Count="0"/></_1><_2 Key="Watch3"><_2 Count="0"/></_2><_3 Key="Watch4"><_3 Count="0"/></_3></CWatchVarList><CWorkSpace m_uSchemaVersion="0"><m_listOfChildState Count="2"><_0><CFrameState m_sName="HTIDE8" m_sPath=".\main.c" m_uSchemaVersion="0" m_Cursor_x="0" m_Cursor_y="31" m_Scroll_x="0" m_Scroll_y="0"><m_wndpl flags="0" length="44" ptMaxPositionX="-4" ptMaxPositionY="-23" ptMinPositionX="-1" ptMinPositionY="-1" rcNormalPositionLeft="44" rcNormalPositionTop="44" rcNormalPositionRight="608" rcNormalPositionBottom="538" showCmd="3"/></CFrameState></_0><_1><CFrameState m_sName="HTIDE8" m_sPath=".\middleware\sigfox\manuf\rf_api.c" m_uSchemaVersion="0" m_Cursor_x="0" m_Cursor_y="45" m_Scroll_x="0" m_Scroll_y="12"><m_wndpl flags="0" length="44" ptMaxPositionX="-4" ptMaxPositionY="-23" ptMinPositionX="-1" ptMinPositionY="-1" rcNormalPositionLeft="132" rcNormalPositionTop="132" rcNormalPositionRight="696" rcNormalPositionBottom="604" showCmd="1"/></CFrameState></_1></m_listOfChildState><m_wndplMainFrame flags="0" length="44" ptMaxPositionX="-3777" ptMaxPositionY="5" ptMinPositionX="-1" ptMinPositionY="-1" rcNormalPositionLeft="-3313" rcNormalPositionTop="31" rcNormalPositionRight="-1916" rcNormalPositionBottom="1084" showCmd="3"/></CWorkSpace><m_listIncludeDir Count="3"><_0 Value="*"/><_1 Value="middleware\sigfox\sigfox-ep-lib\inc"/><_2 Value="drivers\inc"/></m_listIncludeDir><m_listLibDir Count="1"><_0 Value="*"/></m_listLibDir><CBookMarkList Count="0"/><m_listRamMonVar Count="0"/></CHTIdeProject></HTIDE>
<HTIDE><CHTIdeProject g_wProjectVersion="20" m_sProjectDirectory="Z:\tmp\lcd" m_sProjectName="lcd" m_bDefault="0" m_sOutputDir=".\output" m_sTargetChip="BC68F2150" m_nBuildMode="0" m_bListFile="1" m_bGenDisassembly="1" m_bMapFile="1" m_bStandAlone="0" m_bCodFile="0" m_bUseBootLoader="0" m_nBootLoaderMode="0" m_bOtpFile="1" m_bEnterDebugModeAfterBuild="1" m_dwOID="15598078" m_nSteppingCmd="0" m_wFIFOSize="0" m_byteBLID="0" m_strUserBCLPath="" m_bUseHoltekID="1" m_wCustomVID="0" m_wCustomPID="0" m_nEmulatedISPType="-1" m_CompilerFlagString=" -Wall -Os -fshort-enums" m_LinkFlagString="/OptimizeParam=16 /compact_rom /Stack /LInsVarOpt" m_AssemblerFlagString="" m_bCustomUsage="0" m_wUsagePage="65280" m_wUsage="32" m_bPartialLock="0" m_strPartialLockLib="" m_bIdCode_CheckBox="0" m_sIdCode_Edit="" m_strEntryFun="" m_bParseEntryFun="0" m_strGUID="" m_bCodeConfig="0" m_bTraceFields0="0" m_bTraceFields1="0" m_bTraceFields2="1" m_bTraceFields3="0" m_bTraceFields4="0" m_bTraceFields5="0" m_bTraceFields6="0" m_bTraceFields7="0" m_bTraceFields8="0" m_bTraceFields9="0" m_bDisplayVariableValue="1" m_nCrossToolVendor="3" m_bDisplayHexValue="0" m_bDisplayHexValueReg="0" m_bDetectStackOverflow="1" m_bDownLoadEEPROM="0" m_bRunToMainAfterBuild="1" m_CurLibType="8"><CBreakpoint m_nOCDSBreak="105" Count="0"/><m_listOfLib Count="0"/><m_SystemLibArr Count="2"><_0 Value="LIBHOLTEKGCC.LIB" StartAddr="-1" EndAddr="-1"/><_1 Value="v3_lmrsc.lib" StartAddr="-1" EndAddr="-1"/></m_SystemLibArr><m_listOfSecAddr Count="0"/><m_listOfSources Count="12"><_0 Value=".\startup1_l.asm" Attribute="0" StartAddr="-1" EndAddr="-1"/><_1 Value=".\main.c" Attribute="0" StartAddr="-1" EndAddr="-1"/><_2 Value=".\middleware\sigfox\manuf\mcu_api.c" Attribute="0" StartAddr="-1" EndAddr="-1"/><_3 Value=".\middleware\sigfox\manuf\mcu_rf_api_rodata.c" Attribute="0" StartAddr="-1" EndAddr="-1"/><_4 Value=".\middleware\sigfox\manuf\rf_api.c" Attribute="0" StartAddr="-1" EndAddr="-1"/><_5 Value=".\middleware\sigfox\manuf\TI_aes_128_encr_only.c" Attribute="0" StartAddr="-1" EndAddr="-1"/><_6 Value=".\middleware\sigfox\sigfox-ep-lib\src\sigfox_ep_api.c" Attribute="0" StartAddr="-1" EndAddr="-1"/><_7 Value=".\middleware\sigfox\sigfox-ep-lib\src\sigfox_error.c" Attribute="0" StartAddr="-1" EndAddr="-1"/><_8 Value=".\middleware\sigfox\sigfox-ep-lib\src\core\sigfox_crc.c" Attribute="0" StartAddr="-1" EndAddr="-1"/><_9 Value=".\middleware\sigfox\sigfox-ep-lib\src\core\sigfox_ep_bitstream.c" Attribute="0" StartAddr="-1" EndAddr="-1"/><_10 Value=".\middleware\sigfox\sigfox-ep-lib\src\core\sigfox_ep_frequency.c" Attribute="0" StartAddr="-1" EndAddr="-1"/><_11 Value=".\drivers\src\iap.c" Attribute="0" StartAddr="-1" EndAddr="-1"/></m_listOfSources><m_listOfSymDef Count="6"><_0 Value="__V3__"/><_1 Value="Disable_Bit_Initial"/><_2 Value="RC1"/><_3 Value="APPLICATION_MESSAGES"/><_4 Value="UL_BIT_RATE_BPS=100"/><_5 Value="MESSAGE_COUNTER_ROLLOVER=4096"/></m_listOfSymDef><m_DocBook Count="0"/><m_PrjFolder Count="0"/><m_RamMonList Count="4"><_0 AddrFrom="-1" AddrTo="-1" bEnable="0"/><_1 AddrFrom="-1" AddrTo="-1" bEnable="0"/><_2 AddrFrom="-1" AddrTo="-1" bEnable="0"/><_3 AddrFrom="-1" AddrTo="-1" bEnable="0"/></m_RamMonList><CWatchVarList Count="4"><_0 Key="Watch1"><_0 Count="0"/></_0><_1 Key="Watch2"><_1 Count="0"/></_1><_2 Key="Watch3"><_2 Count="0"/></_2><_3 Key="Watch4"><_3 Count="0"/></_3></CWatchVarList><CWorkSpace m_uSchemaVersion="0"><m_listOfChildState Count="0"/><m_wndplMainFrame flags="2" length="44" ptMaxPositionX="63" ptMaxPositionY="32" ptMinPositionX="-32000" ptMinPositionY="-32000" rcNormalPositionLeft="266" rcNormalPositionTop="129" rcNormalPositionRight="1663" rcNormalPositionBottom="1179" showCmd="3"/></CWorkSpace><m_listIncludeDir Count="3"><_0 Value="*"/><_1 Value="middleware\sigfox\sigfox-ep-lib\inc"/><_2 Value="drivers\inc"/></m_listIncludeDir><m_listLibDir Count="1"><_0 Value="*"/></m_listLibDir><CBookMarkList Count="0"/><m_listRamMonVar Count="0"/></CHTIdeProject></HTIDE>
30 changes: 21 additions & 9 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,16 @@ static const __attribute__((at(0x1D00))) unsigned char frame[12] = {0xAA, 0xAA,
#include "sigfox_rc.h"
#include "sigfox_ep_api.h"

SIGFOX_EP_API_application_message_t SIGFOX_EP_API_application_message;
static void _delay_ms(unsigned short delay_ms) {
unsigned short count_ms;
for (count_ms=0 ; count_ms<delay_ms ; count_ms++) {
GCC_DELAY(4000);
}
}


void main() {
unsigned short i;
SIGFOX_EP_API_application_message_t SIGFOX_EP_API_application_message;
SIGFOX_EP_API_config_t SIGFOX_EP_API_config;
//Watchdog
_wdtc = 0b10101000; //Disable WatchDog
Expand All @@ -59,19 +66,24 @@ void main() {
_pawu = 0b11111111;
_pbc = 0b00000000;
_pb = 0b00001111;


_delay_ms(1000);
_pb = 0b00000000;
SIGFOX_EP_API_config.rc = &SIGFOX_RC1;
SIGFOX_EP_API_open(&SIGFOX_EP_API_config);
SIGFOX_EP_API_application_message.common_parameters.t_ifu_ms = 500;
SIGFOX_EP_API_application_message.common_parameters.tx_power_dbm_eirp = 12;
SIGFOX_EP_API_application_message.type = SIGFOX_APPLICATION_MESSAGE_TYPE_BYTE_ARRAY;
SIGFOX_EP_API_application_message.common_parameters.number_of_frames= 3;
SIGFOX_EP_API_application_message.common_parameters.number_of_frames= 1;
SIGFOX_EP_API_application_message.ul_payload_size_bytes = 12;
SIGFOX_EP_API_application_message.ul_payload = frame;


SIGFOX_EP_API_send_application_message(&SIGFOX_EP_API_application_message);
while(1) {

for(i = 0; i < 200; i++)
GCC_DELAY(16000);
// Trigger send with button.
while (_pa1 != 0);
_delay_ms(2000);
SIGFOX_EP_API_open(&SIGFOX_EP_API_config);
SIGFOX_EP_API_send_application_message(&SIGFOX_EP_API_application_message);
SIGFOX_EP_API_close();
}
}
59 changes: 57 additions & 2 deletions middleware/sigfox/manuf/mcu_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,67 +44,122 @@

#ifdef TIMER_REQUIRED
MCU_API_status_t MCU_API_timer_start(MCU_API_timer_t *timer) {
#ifdef ERROR_CODES
MCU_API_status_t status = MCU_API_SUCCESS;
#endif
unsigned short i;

for(i = 0; i < timer->duration_ms; i++) {
GCC_DELAY(4000);
}

RETURN();
}
#endif

#ifdef TIMER_REQUIRED
MCU_API_status_t MCU_API_timer_stop(MCU_API_timer_instance_t timer_instance) {
#ifdef ERROR_CODES
MCU_API_status_t status = MCU_API_SUCCESS;
#endif

RETURN();
}
#endif

#if (defined TIMER_REQUIRED) && !(defined ASYNCHRONOUS)
MCU_API_status_t MCU_API_timer_status(MCU_API_timer_instance_t timer_instance, sfx_bool *timer_has_elapsed) {
#ifdef ERROR_CODES
MCU_API_status_t status = MCU_API_SUCCESS;
#endif

RETURN();
}
#endif

#if (defined TIMER_REQUIRED) && !(defined ASYNCHRONOUS)
MCU_API_status_t MCU_API_timer_wait_cplt(MCU_API_timer_instance_t timer_instance) {
#ifdef ERROR_CODES
MCU_API_status_t status = MCU_API_SUCCESS;
#endif

RETURN();
}
#endif

MCU_API_status_t MCU_API_aes_128_cbc_encrypt(MCU_API_encryption_data_t *aes_data) {
#ifdef ERROR_CODES
MCU_API_status_t status = MCU_API_SUCCESS;
#endif

#ifdef PUBLIC_KEY_CAPABLE
if (aes_data->key == SIGFOX_EP_KEY_PRIVATE) {
aes_encrypt(aes_data->data, (sfx_u8 *)mcu_rf_rodata.testkey);
aes_encrypt(aes_data->data, (sfx_u8 *)mcu_rf_rodata.key);
} else if ((aes_data->key == SIGFOX_EP_KEY_PUBLIC)) {
aes_encrypt(aes_data->data, (sfx_u8 *)SIGFOX_EP_PUBLIC_KEY);
}
#else
aes_encrypt(aes_data->data, (sfx_u8 *) mcu_rf_rodata.testkey);
aes_encrypt(aes_data->data, (sfx_u8 *) mcu_rf_rodata.key);
#endif

RETURN();
}

MCU_API_status_t MCU_API_get_ep_id(sfx_u8 *ep_id, sfx_u8 ep_id_size_bytes) {
#ifdef ERROR_CODES
MCU_API_status_t status = MCU_API_SUCCESS;
#endif

IAP_read(0x1E00, (unsigned short*)ep_id, ep_id_size_bytes / 2);

RETURN();
}

MCU_API_status_t MCU_API_get_nvm(sfx_u8 *nvm_data, sfx_u8 nvm_data_size_bytes) {
#ifdef ERROR_CODES
MCU_API_status_t status = MCU_API_SUCCESS;
#endif
IAP_read(0x1F00, (unsigned short*)nvm_data, nvm_data_size_bytes / 2);

RETURN();
}

MCU_API_status_t MCU_API_set_nvm(sfx_u8 *nvm_data, sfx_u8 nvm_data_size_bytes) {
#ifdef ERROR_CODES
MCU_API_status_t status = MCU_API_SUCCESS;
#endif
IAP_write(0x1F00, (unsigned short*)nvm_data, nvm_data_size_bytes / 2, 1);

RETURN();
}

#ifdef VERBOSE
MCU_API_status_t MCU_API_get_initial_pac(sfx_u8 *initial_pac, sfx_u8 initial_pac_size_bytes) {
#ifdef ERROR_CODES
MCU_API_status_t status = MCU_API_SUCCESS;
#endif

RETURN();
}
#endif

#ifdef VERBOSE
MCU_API_status_t MCU_API_get_version(sfx_u8 **version, sfx_u8 *version_size_char) {
#ifdef ERROR_CODES
MCU_API_status_t status = MCU_API_SUCCESS;
#endif

/* To be implemented by the device manufacturer */
(*version) = (sfx_u8*) mcu_rf_rodata.version;
(*version_size_char) = (sfx_u8) sizeof(mcu_rf_rodata.version);

RETURN();
}
#endif

#ifdef ERROR_CODES
/*******************************************************************/
void MCU_API_error(void) {
/* To be implemented by the device manufacturer */
}
#endif
Loading

0 comments on commit cee7910

Please sign in to comment.