Skip to content
Browse files

change bitrate to 800kbps

  • Loading branch information...
1 parent 2f232d9 commit ed8a4ecdcdf8c3d7d90c3e289dce681649bc795a @hartmutbehrens committed
Showing with 12 additions and 11 deletions.
  1. +1 −1 c2e_can.c
  2. +0 −1 c2e_main.c
  3. +0 −1 c2e_udp.c
  4. +5 −7 c2e_udp.h
  5. +6 −1 config.h
View
2 c2e_can.c
@@ -103,7 +103,7 @@ uint32_t CAN_init(void) // Enabl
// This function transmits 8 bytes at a time out on the CAN bus
void CAN_transmit()
{
- CANMessageSet(CAN0_BASE, 1, &CAN_data.tx_msg_object, MSG_OBJ_TYPE_TX); // Write out this message object using CAN object 1
+ //CANMessageSet(CAN0_BASE, 1, &CAN_data.tx_msg_object, MSG_OBJ_TYPE_TX); // Write out this message object using CAN object 1
tx_message_count += 1;
update_count += 1;
}
View
1 c2e_main.c
@@ -73,7 +73,6 @@ static uint32_t broadcast_presence(void)
{
UDP_broadcast_presence(); // send UDP broadcast messages to indicate the presence of a CAN2Ethernet gateway
return g_state;
- //HWREG(NVIC_INT_CTRL) = NVIC_INT_CTRL_PEND_SV; // Trigger PendSV
}
// wait for stuff to happen - return to previous state
View
1 c2e_udp.c
@@ -4,7 +4,6 @@
#include "utils/lwiplib.h"
#include "utils/ustdlib.h"
#include "drivers/rit128x96x4.h"
-#include "config.h"
#include "c2e_can.h"
#include "c2e_events.h"
#include "c2e_udp.h"
View
12 c2e_udp.h
@@ -1,16 +1,14 @@
#ifndef __C2E_UDP_H
#define __C2E_UDP_H
#include <stdint.h>
+#include "config.h"
#include "lwip/udp.h"
typedef struct
{
- struct udp_pcb *pcb;
- struct pbuf *p_out;
- unsigned char size[4];
- unsigned char msg_type;
- unsigned char *msg_out;
-} udp_can_struct_t;
+ unsigned char options[CMD_OPTION_LEN];
+ unsigned char *msg;
+} udp_message;
void add_gateway(struct ip_addr gw_address); // add an IP address to the list of known gateways
uint32_t gateway_count(void); // return the number of known gateways
@@ -23,4 +21,4 @@ void UDP_start_listen(void);
void process_CAN_data(unsigned char *data, uint32_t total_size);
void UDP_receive(void *arg, struct udp_pcb *pcb, struct pbuf *p, struct ip_addr *addr, u16_t port);
-#endif
+#endif
View
7 config.h
@@ -14,7 +14,7 @@
#define PRINT_BUF_SIZE 20 // OLED print buffer size
#define EV_RINGBUF_SIZE 64 // size of event ring buffer, accomodate up to 64 events
#define CAN_FIFO_SIZE (8 * 8) // size of FIFO buffers allocated to the CAN controller - 8 messages can each hold a max of 8 bytes
-#define CAN_BITRATE 1000000 // set CAN bitrate to 1Mbps
+#define CAN_BITRATE 800000 // set CAN bitrate to 1Mbps
#define MAX_CAN_GATEWAYS 4 // number of CAN gateways to keep track of
#define CAN_ID_POS 0 // position of CAN message ID in CAN frame
#define CAN_DATA_POS 4 // position of CAN data in CAN frame
@@ -46,7 +46,12 @@
#define EV_BROADCAST 6 // send UDP broadcast message to announce presence
#define EV_FOUNDGW 7
#define EV_CHECKIP 8
+// C2E Commands
+#define CMD_OPTION_LEN 12 // length of options that can be set
+#define CMD_C2E_ADVERTISE 2
+#define CMD_C2E_SENDCAN 7
+//SysTick intervals
#define SYSTICKHZ 100
#define SYSTICKMS (1000 / SYSTICKHZ)
#define SYSTICKUS (1000000 / SYSTICKHZ)

0 comments on commit ed8a4ec

Please sign in to comment.
Something went wrong with that request. Please try again.