I am trying to read a simple sensor that puts out an ascii string 14 chars followed by cr and lf, then waits 1/2 second and repeats this string. 9600 baud, 8, n,n (basic serial)
My environment = S3A7 on my own PCB, IAR IDE, SSP 1.2.0. Used Blinky with thread as base. Selected HOCO 48 Mhz, HOCO as main clock.
My Project = Added Communications framework to blinky thread. Set recv buffer to 100, set driver to channel 4, 9600 baud. Enabled receive, disabled transmit. Set recv and error interrupts to level 2. Set ports/sci4 = pins A only, asynchronous UART.
Code: I removed all code from the blinky thread and added the following code:
ssp_err_t module_err;
uint8_t buf[100];
uint32_t goodCount, overflowCount,otherCount;
void blinky_thread_entry(void)
{
module_err = g_sf_comms0.p_api->open(g_sf_comms0.p_ctrl, g_sf_comms0.p_cfg);
while (1)
{
module_err = g_sf_comms0.p_api->read(g_sf_comms0.p_ctrl, &buf[0], 1, TX_WAIT_FOREVER);
if(module_err == SSP_SUCCESS)
goodCount++;
else if(module_err == SSP_ERR_OVERFLOW)
overflowCount++;
else
otherCount++;
}
}
This is the entirety of my project and code.
When run:
- I receive the first 15 characters OK (goodCount = 15)
- Then every subsequent character causes and SSP_ERR_OVERFLOW (overflowCount keeps on climbing)
- Tested this with live watch on the counts
Testing so far:
- Debugged into low level uart code and set breakpoint for fix the hardware over run error. It traps there and resets the SSR bit.
- Fails with or without live watch running
- VERY IMPORTANT: I wired in parallel a logic level to rs232 adaptor. Tera term has absolutely no issues with the data. There are never any bad characters or extra characters etc. This is with or without Synergy running.
- Therefore I do not think there is any hardware issues
- Also verified with scope proper number of characters, good clean signals
This should be a cakewalk. It is driving me crazy. Any ideas would be appreciated.
Steve D