Large diffs are not rendered by default.

Large diffs are not rendered by default.

Binary file not shown.
@@ -22,11 +22,16 @@ <h2>Tool Versions:</h2>

<h2>Project:</h2>
D:\school\Ele217\WeatherStationUiA\OsSide\test.uvprojx
Project File Date: 02/14/2017
Project File Date: 04/06/2017

<h2>Output:</h2>
*** Using Compiler 'V5.06 update 4 (build 422)', folder: 'D:\Code_Stuff\Keil_v5\ARM\ARMCC\Bin'
Build target 'Weatherstation'
compiling comHub.c...
compiling data_Transfer.c...
linking...
Program Size: Code=19416 RO-data=1740 RW-data=120 ZI-data=21968
FromELF: creating hex file...
".\Objects\WeatherStationUiA.axf" - 0 Error(s), 0 Warning(s).

<h2>Software Packages used:</h2>
@@ -36,8 +41,8 @@ <h2>Software Packages used:</h2>
::CMSIS:RTOS:1.0.0 (API)
CMSIS (Cortex Microcontroller Software Interface Standard)
* Component: RTOS Version: 1.0.0
* Component: CORE Version: 5.0.1
* Component: Keil RTX Version: 4.81.0
* Component: CORE Version: 5.0.1

Package Vendor: NordicSemiconductor
http://developer.nordicsemi.com/nRF5_SDK/pieces/nRF_DeviceFamilyPack/NordicSemiconductor.nRF_DeviceFamilyPack.8.11.1.pack
@@ -55,28 +60,28 @@ <h2>Collection of Component Files used:</h2>

* Component: ::CMSIS:RTOS:1.0.0 (API)

* Component: ARM::CMSIS:CORE:5.0.1

* Component: ARM::CMSIS:RTOS:Keil RTX:4.81.0
Source file: CMSIS\RTOS\RTX\UserCodeTemplates\MsgQueue.c
Source file: CMSIS\RTOS\RTX\UserCodeTemplates\main.c
Source file: CMSIS\RTOS\RTX\Templates\RTX_Conf_CM.c
Source file: CMSIS\RTOS\RTX\UserCodeTemplates\MemPool.c
Library file: CMSIS\RTOS\RTX\LIB\ARM\RTX_CM4.lib
Source file: CMSIS\RTOS\RTX\UserCodeTemplates\Mutex.c
Source file: CMSIS\RTOS\RTX\UserCodeTemplates\MemPool.c
Source file: CMSIS\RTOS\RTX\UserCodeTemplates\MailQueue.c
Source file: CMSIS\RTOS\RTX\UserCodeTemplates\Semaphore.c
Source file: CMSIS\RTOS\RTX\UserCodeTemplates\Thread.c
Include file: CMSIS\RTOS\RTX\UserCodeTemplates\osObjects.h
Source file: CMSIS\RTOS\RTX\SRC\ARM\SVC_Table.s
Include file: CMSIS\RTOS\RTX\INC\cmsis_os.h
Source file: CMSIS\RTOS\RTX\UserCodeTemplates\MsgQueue.c
Source file: CMSIS\RTOS\RTX\Templates\RTX_Conf_CM.c
Source file: CMSIS\RTOS\RTX\UserCodeTemplates\MailQueue.c
Source file: CMSIS\RTOS\RTX\UserCodeTemplates\main.c
Include file: CMSIS\RTOS\RTX\UserCodeTemplates\osObjects.h
Source file: CMSIS\RTOS\RTX\UserCodeTemplates\Timer.c
Source file: CMSIS\RTOS\RTX\UserCodeTemplates\Thread.c

* Component: ARM::CMSIS:CORE:5.0.1

* Component: NordicSemiconductor::Device:Startup:8.11.1
Include file: Device\Include\system_nrf52.h
Source file: Device\Source\arm\arm_startup_nrf52.s
Source file: Device\Source\system_nrf52.c
Build Time Elapsed: 00:00:00
Build Time Elapsed: 00:00:02
</pre>
</body>
</html>

Large diffs are not rendered by default.

BIN +14 Bytes (100%) OsSide/Objects/comhub.crf
Binary file not shown.
BIN -118 Bytes (100%) OsSide/Objects/data_transfer.crf
Binary file not shown.
BIN +37 Bytes (100%) OsSide/Objects/main.crf
Binary file not shown.
BIN +0 Bytes (100%) OsSide/Objects/rtx_conf_cm.crf
Binary file not shown.

Large diffs are not rendered by default.

@@ -74,10 +74,9 @@ void spi_event_handler(nrf_drv_spi_evt_t const * p_event)
}
}

void SPI_init()
void SPI_init(void)
{
NRF_LOG_INFO("init SPI\r\n");
NRF_LOG_FLUSH();
nrf_drv_spi_config_t spi_config = NRF_DRV_SPI_DEFAULT_CONFIG;
spi_config.ss_pin = SPI_SS_PIN;
spi_config.miso_pin = SPI_MISO_PIN;
@@ -104,73 +103,65 @@ void SPI_init()

void SPI_controller(void const *argument)
{
NRF_LOG_INFO("SPI Thread start\r\n");
NRF_LOG_FLUSH();
uint8_t wait = 50; //wait variable, constant for now, might change later
while(1)
//NRF_LOG_INFO("SPI Thread start\r\n");
uint8_t wait = 100; //wait variable, constant for now, might change later
osEvent event_m;
osEvent event_s;

while(1) // loop for mail/signal queueing, if signal recieved, prepare to recieve package, if mail prepare to send recieved mail content
{
osEvent event_m;
osEvent event_s;
while(1) // loop for mail/signal queueing, if signal recieved, prepare to recieve package, if mail prepare to send recieved mail content

event_s = osSignalWait(1,wait);
if (event_s.value.signals == 1) // recieve code
{
NRF_LOG_INFO("Received mode\r\n");
//set ack hight to acknowledge send request
nrf_drv_gpiote_out_set(PIN_ACK);
tx_clr(m_tx_buf, m_length);

NRF_LOG_INFO("Received mode\r\n");
NRF_LOG_FLUSH();
event_s = osSignalWait(1,wait);
if (event_s.value.signals == 1) // recieve code
//wait for spis to set syn low to autorise transfer start
event_s = osSignalWait(0,osWaitForever);\

spi_xfer_done = false;
nrf_drv_spi_transfer(&spi, m_tx_buf, m_length, m_rx_buf, m_length);
//set ack low to signal start of transfer
nrf_drv_gpiote_out_clear(PIN_ACK);
while (!spi_xfer_done)
{
//set ack hight to acknowledge send request
nrf_drv_gpiote_out_set(PIN_ACK);
tx_clr(m_tx_buf, m_length);

//wait for spis to set syn low to autorise transfer start
event_s = osSignalWait(0,osWaitForever);\

spi_xfer_done = false;
nrf_drv_spi_transfer(&spi, m_tx_buf, m_length, m_rx_buf, m_length);
//set ack low to signal start of transfer
osDelay(50);
}

break;
}
event_m = osMailGet(mail_pool_q_id[0],50);
if (event_m.status == osEventMail) //send code
{
NRF_LOG_INFO("Send mode\r\n");
mail_protocol_t *mail =(mail_protocol_t*)event_m.value.p;
while(event_s.value.v == 1)
{
nrf_drv_gpiote_out_clear(PIN_ACK);
while (!spi_xfer_done)
{
osDelay(50);
}

break;
osDelay(wait);
//set ack high to signalise intent to transfer
nrf_drv_gpiote_out_set(PIN_ACK);
//wait for Syn to go high for acknowledgement of transfer
event_s = osSignalWait(1,50);

//if syn does not go high, set ack low, wait a moment and try again

}
event_m = osMailGet(mail_pool_q_id[0],wait);
if (event_m.status) //send code
//prepare transfer
NRF_LOG_INFO("prepare transfer\r\n");
tx_set(m_tx_buf,(uint8_t*)mail->pld, m_length);
spi_xfer_done = false;
nrf_drv_spi_transfer(&spi, m_tx_buf, m_length, m_rx_buf, m_length);

NRF_LOG_INFO("wait for transfer done\r\n");
while (!spi_xfer_done)
{
NRF_LOG_INFO("Send mode\r\n");
NRF_LOG_FLUSH();
while(1)
{
//set ack high to signalise intent to transfer
nrf_drv_gpiote_out_set(PIN_ACK);
//wait for Syn to go high for acknowledgement of transfer
event_s = osSignalWait(1,50);
if(event_s.value.v == 1)
{
//prepare transfer
NRF_LOG_INFO("prepare transfer\r\n");
NRF_LOG_FLUSH();
tx_set(m_tx_buf,(uint8_t*)event_m.value.v, m_length);
spi_xfer_done = false;
nrf_drv_spi_transfer(&spi, m_tx_buf, m_length, m_rx_buf, m_length);

NRF_LOG_INFO("wait for transfer done\r\n");
NRF_LOG_FLUSH();
while (!spi_xfer_done)
{
osDelay(50);
}
nrf_drv_gpiote_out_clear(PIN_ACK);
break;
}
//if syn does not go high, set ack low, wait a moment and try again
nrf_drv_gpiote_out_clear(PIN_ACK);
osDelay(50);
}
}
nrf_drv_gpiote_out_clear(PIN_ACK);
}
}
}
@@ -31,7 +31,7 @@ typedef struct{

//init functions
void SPI_init(void);

void comhub_init(void);
//thread functions
void SPI_controller(void const *argument);
void comhub(void const *argument);
@@ -9,35 +9,33 @@ osMailQId (mail_q_in_id);

extern osMailQId PcalQ_Id;

void comhub(void const *argument)
void comhub_init()
{
NRF_LOG_INFO("init com hub\r\n");
NRF_LOG_FLUSH();
// mail subsctiption system implementation
mail_q_in_id = osMailCreate(osMailQ(mail_pool_q), NULL);
mail_pool_q_id[0] = osMailCreate(osMailQ(mail_pool_q), NULL);
mail_pool_q_id[1] = osMailCreate(osMailQ(mail_pool_q), NULL);
mail_pool_q_id[2] = osMailCreate(osMailQ(mail_pool_q), NULL);
mail_pool_q_id[3] = osMailCreate(osMailQ(mail_pool_q), NULL);
}
void comhub(void const *argument)
{
osEvent evt;

//init malqueue then
//wait for mail


while(1)
{
evt = osMailGet(mail_q_in_id,osWaitForever);
if(evt.status == osEventMail)
{
mail_protocol_t *received = (mail_protocol_t *)evt.value.p;

NRF_LOG_INFO("mail %s recieved from, %i, sending to %i\r\n", (uint32_t)received->pld, received->rid,received->sid);
NRF_LOG_FLUSH();
NRF_LOG_INFO("mail %x recieved from, %i, sending to %i\r\n" ,*received->pld ,received->rid,received->sid);
mail_protocol_t *outbound;
outbound = (mail_protocol_t *) osMailAlloc(mail_q_in_id, osWaitForever);
outbound = (mail_protocol_t *) osMailAlloc(mail_pool_q_id[(uint8_t)received->rid], osWaitForever);
outbound = received;
osMailPut(mail_pool_q_id[received->rid], outbound);
osMailPut(mail_pool_q_id[(uint8_t)received->rid], outbound);

osMailFree(mail_q_in_id, received);
}
@@ -62,4 +60,4 @@ uint8_t sendMail(uint8_t flags, uint8_t *package, mail_protocol_t *sptr, uint8_t
sptr->pld = package;
sptr->flg = flags;
osMailPut(PcalQ_Id, sptr);
}*/
}*/
@@ -40,8 +40,9 @@ int main (void) {
APP_ERROR_CHECK(NRF_LOG_INIT(NULL));

NRF_LOG_INFO("Log initialized\r\n");
NRF_LOG_FLUSH();
SPI_init();
comhub_init();
NRF_LOG_FLUSH();
tid_comhub = osThreadCreate (osThread(comhub),NULL);
tid_SPI = osThreadCreate (osThread(SPI_controller),NULL);

@@ -50,22 +51,22 @@ int main (void) {


osKernelStart (); // start thread execution

NRF_LOG_INFO("sending testmsg\r\n");
NRF_LOG_FLUSH();
uint8_t msg[] = {'b','o','o'};
uint8_t msg[] = {0x0F,0xF0,0xFF};

mail_protocol_t *testmsg;
testmsg = (mail_protocol_t *) osMailAlloc(mail_q_in_id, osWaitForever);
testmsg->sid = NULL;
testmsg->sid = 255;
testmsg->rid = 0;
testmsg->flg = 0;
testmsg->pld = msg;
osMailPut(mail_q_in_id, testmsg);

while(1)
{

//osSignalWait(0,0);
osDelay(50);
NRF_LOG_FLUSH();
}
}

Large diffs are not rendered by default.

@@ -259,6 +259,118 @@
<ExecCommand></ExecCommand>
<Expression></Expression>
</Bp>
<Bp>
<Number>7</Number>
<Type>0</Type>
<LineNumber>48</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>0</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>0</BreakIfRCount>
<Filename>.\main.c</Filename>
<ExecCommand></ExecCommand>
<Expression></Expression>
</Bp>
<Bp>
<Number>8</Number>
<Type>0</Type>
<LineNumber>55</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>0</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>0</BreakIfRCount>
<Filename>.\main.c</Filename>
<ExecCommand></ExecCommand>
<Expression></Expression>
</Bp>
<Bp>
<Number>9</Number>
<Type>0</Type>
<LineNumber>63</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>0</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>0</BreakIfRCount>
<Filename>.\main.c</Filename>
<ExecCommand></ExecCommand>
<Expression></Expression>
</Bp>
<Bp>
<Number>10</Number>
<Type>0</Type>
<LineNumber>69</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>0</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>0</BreakIfRCount>
<Filename>.\main.c</Filename>
<ExecCommand></ExecCommand>
<Expression></Expression>
</Bp>
<Bp>
<Number>11</Number>
<Type>0</Type>
<LineNumber>136</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>0</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>0</BreakIfRCount>
<Filename>.\Resources\data_Transfer.c</Filename>
<ExecCommand></ExecCommand>
<Expression></Expression>
</Bp>
<Bp>
<Number>12</Number>
<Type>0</Type>
<LineNumber>139</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>0</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>0</BreakIfRCount>
<Filename>.\Resources\data_Transfer.c</Filename>
<ExecCommand></ExecCommand>
<Expression></Expression>
</Bp>
<Bp>
<Number>13</Number>
<Type>0</Type>
<LineNumber>38</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>0</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>0</BreakIfRCount>
<Filename>.\comHub.c</Filename>
<ExecCommand></ExecCommand>
<Expression></Expression>
</Bp>
</Breakpoint>
<Tracepoint>
<THDelay>0</THDelay>
@@ -413,7 +525,7 @@
<SetRegEntry>
<Number>0</Number>
<Key>DLGUARM</Key>
<Name>Hñ¼</Name>
<Name>ÀñO</Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
@@ -430,66 +542,98 @@
<Bp>
<Number>0</Number>
<Type>0</Type>
<LineNumber>30</LineNumber>
<LineNumber>52</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>6934</Address>
<Address>0</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>.\comHub.c</Filename>
<BreakIfRCount>0</BreakIfRCount>
<Filename>.\main.c</Filename>
<ExecCommand></ExecCommand>
<Expression>\\WeatherStationUiA\comHub.c\30</Expression>
<Expression></Expression>
</Bp>
<Bp>
<Number>1</Number>
<Type>0</Type>
<LineNumber>37</LineNumber>
<LineNumber>48</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>8422</Address>
<Address>0</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<BreakIfRCount>0</BreakIfRCount>
<Filename>.\main.c</Filename>
<ExecCommand></ExecCommand>
<Expression>\\WeatherStationUiA\main.c\37</Expression>
<Expression></Expression>
</Bp>
<Bp>
<Number>2</Number>
<Type>0</Type>
<LineNumber>52</LineNumber>
<LineNumber>38</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>8500</Address>
<Address>6790</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>.\main.c</Filename>
<Filename>.\comHub.c</Filename>
<ExecCommand></ExecCommand>
<Expression>\\WeatherStationUiA\main.c\52</Expression>
<Expression>\\WeatherStationUiA\comHub.c\38</Expression>
</Bp>
<Bp>
<Number>3</Number>
<Type>0</Type>
<LineNumber>47</LineNumber>
<LineNumber>69</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>0</Address>
<Address>8432</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>0</BreakIfRCount>
<BreakIfRCount>1</BreakIfRCount>
<Filename>.\main.c</Filename>
<ExecCommand></ExecCommand>
<Expression></Expression>
<Expression>\\WeatherStationUiA\main.c\69</Expression>
</Bp>
<Bp>
<Number>4</Number>
<Type>0</Type>
<LineNumber>136</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>4586</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>.\Resources\data_Transfer.c</Filename>
<ExecCommand></ExecCommand>
<Expression>\\WeatherStationUiA\Resources/data_Transfer.c\136</Expression>
</Bp>
<Bp>
<Number>5</Number>
<Type>0</Type>
<LineNumber>139</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>4608</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>.\Resources\data_Transfer.c</Filename>
<ExecCommand></ExecCommand>
<Expression>\\WeatherStationUiA\Resources/data_Transfer.c\139</Expression>
</Bp>
</Breakpoint>
<Tracepoint>