Jump to content

js9013

Members
  • Content count

    6
  • Joined

  • Last visited

  1. .sslConnect() not working

    I have a very basic requirement to send a HTTPS request to AWS. I am using the basic sample code from Energia for my MSP432. I have no issues establishing an unsecured HTTP request using .connect(), but AWS requires HTTPS. To that end, I am trying to use the .sslConnect() function provided in Energia to no avail - I am not able to establish a connect with the AWS server. Can anyone suggest what my issues are with the code below? Are there common issues I should look at to debug? Thank you! char server[] = "xxxxxxxx.execute-api.us-xxxx-2.amazonaws.com"; { Serial.println("\nStarting connection to server..."); // if you get a connection, report back via serial: if (client.sslConnect(server, 8443)) { Serial.println("connected to server"); // Make a HTTP request: client.println("GET /xxxx/myAWSfunction HTTP/1.1"); client.println("Host: xxxx.execute-api.us-xxxx-2.amazonaws.com"); client.println("Connection: close"); client.println(); } }
  2. Sorry for the multiple posts - but I believe my last post was actually incorrect. Does the WebClient example send over HTTP by default? My endpoints requires HTTPS, and this is one of the only possibilities for this problem that I can imagine.
  3. Never mind, I've ruled this out as a possibility. Would still appreciate any one's insight as to what could cause Energia/the board to be the only source from which this endpoint gives a 301 response...
  4. Hello, I am trying to use my MSP432 to make a REST call to an endpoint I already have set up and configured. I know this endpoint works. However, when I try to use the the WiFiWebClient example in Energia, I receive an HTTP 301 redirect error. I suspect this could be due to the difference between HTTP/HTTPS. Is it possible to use make an HTTPS request using this Energia example? Thank you!
  5. Can anybody assist?
  6. Hello, I recently ported over an Energia sketch that had working WiFi functionality in order to help with remote logging for a project I'm working on. The WiFi works well, but now the CCS code that was handling the ADC interrupts and measuring data is no longer functioning. If possible, I would like to make minimal changes to the CCS code as it was working exactly as we desired. I feel like there must be a relatively simple fix that I'm missing but I can't seem to figure it out. Can someone please help figure out what's wrong the ADC interrupt in the following code? #include <stdint.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <math.h> #include "inc/hw_types.h" #include "inc/hw_gpio.h" #include "inc/hw_memmap.h" #include "inc/hw_ints.h" #include "sysctl.h" #include "gpio.h" #include "driverlib/gpio.h" #include "driverlib/timer.h" #include "driverlib/interrupt.h" #include "driverlib/debug.h" #include "driverlib/adc.h" #include "inc/tm4c123gh6pm.h" #include <string.h> #include <WiFiClient.h> #ifndef __CC3200R1M1RGC__ // Do not include SPI for CC3200 LaunchPad #include <SPI.h> #endif #include <WiFi.h> // your network name also called SSID char ssid[] = ""; // your network password char password[] = ""; WiFiClient client; IPAddress server(); uint16_t port = ; #define SAMPLING_RATE 80000.0 // #define TARGET_FREQUENCY 10000.0 // #define BLOCK_SIZE 80 #define BUFFER_SIZE 255 //result cannot be declared in interrupt handler uint8_t flag = 0; uint32_t buffer[BUFFER_SIZE]; uint32_t bufferIndex = 0; float goertzel(uint32_t buffer[]) { int k, i; const float floatN = (float)BLOCK_SIZE; float omega; k = (int) (0.5 + ((floatN * TARGET_FREQUENCY ) / SAMPLING_RATE)); omega = (2.0 * 3.14 * k)/floatN; float sine = sin(omega); float cosine = cos(omega); float coeff = 2.0 * cosine; float Q0 = 0; float Q1 = 0; float Q2 = 0; float scaling_factor = BLOCK_SIZE/2.0; for (i = 0; i < BUFFER_SIZE; i++) { Q0 = coeff * Q1 - Q2 + buffer[i]; Q2 = Q1; Q1 = Q0; } float imag, real, result; real = (Q1 - Q2 * cosine) / scaling_factor; imag = (Q2 * sine) / scaling_factor; result = sqrtf(real * real + imag * imag); return result; } void ADC3IntHandler(void) { float result = 0.0; ADCIntClear(ADC0_BASE, 3); if (flag == 0) { //GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_0, GPIO_PIN_0); flag = 1; } else { //GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_0, 0); flag = 0; } if (bufferIndex >= 255) { bufferIndex = 0; ADCSequenceDisable(ADC0_BASE, 3); result = goertzel(buffer); client.println(result); ADCSequenceEnable(ADC0_BASE, 3); } ADCSequenceDataGet(ADC0_BASE, 3, (buffer + bufferIndex)); bufferIndex++; } void setupADC(void) { SysCtlClockSet(SYSCTL_SYSDIV_2_5 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_25MHZ); //Enable ADC0 and timer SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB); SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0); //pin for testing //GPIOPinTypeGPIOOutput(GPIO_PORTB_BASE, GPIO_PIN_0); TimerConfigure(TIMER0_BASE, TIMER_CFG_PERIODIC); TimerClockSourceSet(TIMER0_BASE, TIMER_CLOCK_SYSTEM); //625 - 40 kHz sampling rate TimerLoadSet(TIMER0_BASE, TIMER_B, 625); TimerControlTrigger(TIMER0_BASE, TIMER_B, true); //Disable before configuring ADCSequenceDisable(ADC0_BASE, 3); ADCSequenceConfigure(ADC0_BASE, 3, ADC_TRIGGER_TIMER, 0); ADCSequenceStepConfigure(ADC0_BASE, 3, 0, ADC_CTL_CH0 | ADC_CTL_IE | ADC_CTL_END); //sequencer 3 on PE3 SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE); //PE3 ADC pin GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_3); IntRegister(INT_ADC0SS3, ADC3IntHandler); ADCIntRegister(ADC0_BASE, 3, ADC3IntHandler); IntMasterEnable(); IntEnable(INT_ADC0SS3); ADCIntEnable(ADC0_BASE, 3); ADCSequenceEnable(ADC0_BASE, 3); SysCtlDelay(10); TimerEnable(TIMER0_BASE, TIMER_B); //Timer A conflicts with SPI of wifi module ADCIntClear(ADC0_BASE, 3); } void setup() { setupADC(); WiFi.begin(ssid, password); while ( WiFi.status() != WL_CONNECTED) { delay(300); } while (WiFi.localIP() == INADDR_NONE) { delay(300); } uint8_t tries = 0; while (client.connect(server, port) == false) { if (tries++ > 100) { while(1); } delay(100); } delay(1000); } void loop() { //client.println("hello"); } Thank you!
×